HighTechTalks DotNet Forums  

ADO Query gives "No value given for one or more required parameters" onjoin

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss ADO Query gives "No value given for one or more required parameters" onjoin in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Paul Blevins
 
Posts: n/a

Default ADO Query gives "No value given for one or more required parameters" onjoin - 12-14-2009 , 10:04 PM






I have the following code:
Dim strSubmittalRatesSQL = "select distinct v.[Vendor]," & _
"(select MAX([rate1]) FROM (" & _
"select top 50 percent ((t1.[MaxSubmittaltrnBillRateST]-t1.[POAvgOrigBillRateST])/t1.[POAvgOrigBillRateST])*100 as [rate1] " & _
"from [Sikorsky_Submittal$] t1 " & _
"where t1.[trnVendorName] = v.[Vendor] " & _
"and t1.[POAvgOrigBillRateST] is not null " & _
"order by ((t1.[MaxSubmittaltrnBillRateST]-t1.[POAvgOrigBillRateST])/t1.[POAvgOrigBillRateST])*100 asc " & _
") h1) + " & _
"(select MIN([rate2]) FROM ( " & _
"select top 50 percent ((t2.[MaxSubmittaltrnBillRateST]-t2.[POAvgOrigBillRateST])/t2.[POAvgOrigBillRateST])*100 as [rate2] " & _
"from [Sikorsky_Submittal$] t2 " & _
"where t2.[trnVendorName] = v.[Vendor] " & _
"and t2.[POAvgOrigBillRateST] is not null " & _
"order by ((t2.[MaxSubmittaltrnBillRateST]-t2.[POAvgOrigBillRateST])/t2.[POAvgOrigBillRateST])*100 desc " & _
") h2) " & _
"as [SubmittalRates1] " & _
"from [Sikorsky_Vendors$] v"

it doesn't like the t2.[trnVendorName] = v.[Vendor]. This query does work in SQL. The datasource is Excel. I'm at a loss of why it doesn't like the join here.


Submitted via EggHeadCafe - Software Developer Portal of Choice
Xcompress - IIS HTTP Compression
http://www.eggheadcafe.com/tutorials/aspnet/c5a74a2e-01b5-4b6c-95c7-861a0909f404/xcompress--iis-http-comp.aspx

Reply With Quote
  #2  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: ADO Query gives "No value given for one or more required parameters" on join - 12-15-2009 , 09:52 AM






First, what happens if you run the query from within SQL Server (just to
make sure if it works)? Assuming it does (since you say it works in SQL), I
would try adding the different parts to strSubmittalRatesSQL one piece at a
time in order to narrow down where the actual problem is. Or, if you have it
working from within SQL Server, actually COPY AND PASTE the SQL code just to
make sure you don't make any typos in the moving process. I know I sound
like I'm stating the obvious, but I have seen (and once in a while made!)
errors so stupid (like a typo) and that can be so easily fixed (like
breaking it down into the different pieces), that I just want to hit myself
in the head, so it never hurts to try these things.
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

<Paul Blevins> wrote

Quote:
I have the following code:
Dim strSubmittalRatesSQL = "select distinct v.[Vendor]," & _
"(select MAX([rate1]) FROM (" & _
"select top 50 percent
((t1.[MaxSubmittaltrnBillRateST]-t1.[POAvgOrigBillRateST])/t1.[POAvgOrigBillRateST])*100
as [rate1] " & _
"from [Sikorsky_Submittal$] t1 " & _
"where t1.[trnVendorName] = v.[Vendor] " & _
"and t1.[POAvgOrigBillRateST] is not null " & _
"order by
((t1.[MaxSubmittaltrnBillRateST]-t1.[POAvgOrigBillRateST])/t1.[POAvgOrigBillRateST])*100
asc " & _
") h1) + " & _
"(select MIN([rate2]) FROM ( " & _
"select top 50 percent
((t2.[MaxSubmittaltrnBillRateST]-t2.[POAvgOrigBillRateST])/t2.[POAvgOrigBillRateST])*100
as [rate2] " & _
"from [Sikorsky_Submittal$] t2 " & _
"where t2.[trnVendorName] = v.[Vendor] " & _
"and t2.[POAvgOrigBillRateST] is not null " & _
"order by
((t2.[MaxSubmittaltrnBillRateST]-t2.[POAvgOrigBillRateST])/t2.[POAvgOrigBillRateST])*100
desc " & _
") h2) " & _
"as [SubmittalRates1] " & _
"from [Sikorsky_Vendors$] v"

it doesn't like the t2.[trnVendorName] = v.[Vendor]. This query does
work in SQL. The datasource is Excel. I'm at a loss of why it doesn't
like the join here.


Submitted via EggHeadCafe - Software Developer Portal of Choice
Xcompress - IIS HTTP Compression
http://www.eggheadcafe.com/tutorials/aspnet/c5a74a2e-01b5-4b6c-95c7-861a0909f404/xcompress--iis-http-comp.aspx

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.