Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Good Day.

 

I encountered a problem when filling a dataset using the OleDbDataAdapter. The scenario is like this:

 

I created an object say, Record, that has a DataSet member variable in it. The DataSet's Tables and Columns definition are dynamically defined and created based on a XmlSchema. When filling a specific table in the DataSet, the SelectCommand.CommandText and the Parameters are dynamically created before calling the Adapter.Fill method.

 

example sql: SELECT * FROM CUSTOMER WHERE id=@id

 

where : @id = is created as a parameter for the SelectCommand

and the Param.Value is set to a known value

 

---------------------------------------------------------------

Error Message: Must declare the variable @id

---------------------------------------------------------------

 

What is strange is that when using SqlConnection and SqlDataAdapter instead of the OleDbConnection and OleDbDataAdapter, the DataSet if properly filled and the program runs without problem.

 

I think the problem is with the OleDbDataAdapter. I'm new to C# and hopefully you can give me some information and guidance.

 

Best Regards...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...