Hello ,
I want to Databind some TextBox in a Winform to an Access Database.
If I make the databinding with a Yes/No field (a OleDbType.Boolean ),
field Active in my example, it works fine.
The problem comes, with a field that is Text in the Access DB. I can't
find the correct mapping with the OleDBType, any Oledbtype mapped as
String works.
This code is working well :
----------------------------------------------------------------------
OleDbCommand cmd = new OleDbCommand("UPDATE APP_Documents SET Active =
@Active WHERE Id = @Id",this.oleDbConnection1);
cmd.Parameters.Add("@Active", OleDbType.Boolean , 50, "Active");
cmd.Parameters.Add("@Id", OleDbType.Integer, 4, "Id");
this.oleDbDataAdapter1.UpdateCommand = cmd;
this.oleDbDataAdapter1.Update(dataSet11);
----------------------------------------------------------------------
This one not:
OleDbCommand cmd = new OleDbCommand("UPDATE APP_Documents SET Active =
@Active, Comment = @Comment WHERE Id = @Id",this.oleDbConnection1);
cmd.Parameters.Add("@Comment",OleDbType.Variant, 254, "Comment");
cmd.Parameters.Add("@Active", OleDbType.Boolean , 50, "Active");
cmd.Parameters.Add("@Id", OleDbType.Integer, 4, "Id");
this.oleDbDataAdapter1.UpdateCommand = cmd;
this.oleDbDataAdapter1.Update(dataSet11);
I'm inserting the first parameter (which value is databinded into a
TextBox) & changing de SQL of the OleDbCommand. When I change the
value and I save the changes I can't Update the DataAdapter.
Help, please!
Thanks!
RFM
|