PC Review


Reply
Thread Tools Rate Thread

Databinding TextBox in MSAccess

 
 
RFM
Guest
Posts: n/a
 
      2nd Aug 2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
textbox and databinding Alcibiade Microsoft VB .NET 4 1st Sep 2009 08:57 AM
compare msaccess and textbox value sujitha_h@yahoo.com Microsoft Access External Data 1 5th Apr 2007 02:14 AM
Databinding with the textbox? Monty Microsoft Dot NET 1 2nd Mar 2006 08:15 AM
Databinding to the textbox Monty Microsoft Dot NET 1 2nd Mar 2006 08:13 AM
defaultvalue in textbox - MsAccess Jan Vacek Microsoft Access VBA Modules 4 17th May 2004 01:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:08 PM.