>>>I have created data reader with parameters many times but now I need to create a dataset and I am lost.
>>>
>>>Here is an example:
>>>
>>>
>>>OleDbConnection oDbConnection = new OleDbConnection
>>>(connectionString);
>>>
>>>string strSqlCommand = "select * MYTABLE where MYFIELD(?)";
>>>
>>>OleDbDataAdapter objAdapter = new OleDbDataAdapter(strSqlCommand,
>>>oDbConnection);
>>>
>>>DataSet dsMyTable = new DataSet();
>>>
>>>objAdapter.Fill(dsMyTable, "tblMyTable");
>>>
>>>
>>>
>>>Somewhere above I have to specify parameter for field MYFIELD but I don't know how and where.
>>>
>>>Thank you in advance for any help.
>>
>>
>>I found out that I probably need to add the parameret to the Adapter object, as following:
>>
>>
>>objAdapter.GetFillParameters()[0].Value = nMyValue;
>>
>>
>>But I get an error on this line that index is invalid. So I think I need to find a way to specify that the adapter takes so many paramenters. I can't find how to do it so far.
>
>Dmitry,
>I usually use parameters with SPROCS instead of with straight SQL, so I don't know exactly what you need to do, but I think you are specifying your parameter incorrectly in your SQL.
>
>Try changing you SQL to something like this:
>
>"select * MYTABLE where MYFIELD = @MyFieldParm";
>
>and your code to something like this:
>
>objAdapter.GetFillParameters()["@MyFieldParm"].Value = nMyValue;
>
Mike,
In this particular case I am not using stored procedure, but rather getting data from VFP database using OleDb Driver.
Thank you.
"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