Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OleDBDataAdapter.Update
Message
From
28/02/2005 09:52:00
 
 
To
28/02/2005 07:25:26
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00991026
Message ID:
00991160
Views:
16
Hey Grig,

>I didn't design the application and there is no table. <

No table? Odd. Then why did you have a table in your .Update() statement? Well, never mind, the solution is simple. Don't use .Update(), don't even use the DataAdapter. Try this (untested code, watch for typos):
OleDbCommand command = new OleDbCommand("Insert into table (field1, field2) Values (@par1, @par2)", MyConnection);
command.Parameters.Add("@par1","value1")
command.Parameters.Add("@par2","value2")
command.ExecuteNonQuery();
~~Bonnie




>Hi, Bonnie
>
>Thank you for your time. Unfortunatelly, it doesn't. I didn't design the application and there is no table. Actually, the original code was a string concatenation to build an SQL command. Problem is the values could contain invalid SQL characters (such as '), but perfectly good data, and I tried to overcome this problem by adding the values as parameters to that OleDbDataAdapter.
>
>I'm kind of stuck.
>
>Thanks
>
>>To add rows to your DataTable, try this on for size:
>>
>>DataRow row = MyTable.NewRow();
>>row["MyColumn"] = "whatever";
>>MyTable.Rows.Add(row);
>>
>>I don't have any particular step-by-step to recommend off the top of my head. I don't think I have anything good bookmarked at the moment. But, maybe the above example will get you started?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform