Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFPOLEDB and Parameters
Message
 
 
To
29/06/2004 17:19:46
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00918644
Message ID:
00918707
Views:
9
What command do you execute? Do you have
OleDbReader myReader = objCmd.ExecuteReader();
Or you use another command?

>I get
>
>
>No value give for one or more parameters.
>
>
>>One other thing. Try changing your command to the following syntax:
>>
>>
>>OleDbCommand objCmd = new OleDbCommand("select * from customers where CustomerID = (?)");
>>objCmd.Parameters.Add("@myParam", "ALFKI");
>>
>>
>>Note that you don't need the "myParam" in the SQL Select.
>>
>>HTH.
>>
>>>I tried:
>>>
>>>OleDbCommand objCmd = new OleDbCommand("select * from customers where CustomerID = ?myParam");
>>>objCmd.Parameters.Add("@myParam", "ALFKI");
>>>
>>>
>>>gives me
>>>
>>>
>>>Command contains unrecognized phrase/keyword.
>>>
>>>
>>>and
>>>
>>>
>>>OleDbCommand objCmd = new OleDbCommand("select * from customers where CustomerID = ?myParam");
>>>objCmd.Parameters.Add("@myParam", "ALFKI");
>>>
>>>
>>>gives me
>>>
>>>
>>>Missing operand.
>>>
>>>>I think you are missing "@" in your syntax. I think it should be
>>>>
>>>>
>>>>objCmd.Parameters.Add("@CustomerID", "ALFKI");
>>>>
>>>>
>>>>HTH.
>>>>
>>>>>I'm using the VFPOLEDB provider and I am creating a command object like this:
>>>>>
>>>>>
>>>>>OleDbCommand objCmd = new OleDbCommand("select * from customers where CustomerID = ?");
>>>>>objCmd.Parameters.Add("CustomerID", "ALFKI");
>>>>>
>>>>>
>>>>>When I execute this command I am getting an OleDbException that says:
>>>>>
>>>>>
>>>>>No value given for one or more required parameters.
>>>>>
>>>>>
>>>>>How do I use the parameter collection to pass parementers to commands?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform