|
-
Mar 17th, 2007, 12:45 AM
#1
Thread Starter
Addicted Member
update records in the Ms Access
hi to all,
i have created one table in Ms Access is
string query="create table testtable1(Name Text(50),age Number,email Text(50),phoneno Text(50),sysdate DateTime)";
clsGlobalFields.oledbcon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ txtdbsName.Text +";persist security Info=false");
clsGlobalFields.oledbcon.Open();
clsGlobalFields.oledbcmd = new OleDbCommand(query, clsGlobalFields.oledbcon);
clsGlobalFields.oledbcmd.ExecuteNonQuery();
clsGlobalFields.oledbcon.Close();
when i am inserting the value in that table,it fine. But when i am updating the value in that table it given the error"Type mismatch".
Actually i have used two update queries
one update query work fine. the query is
string query="update testtable1 set Name = 'mary' , age = 20, email = 'kfolklklklklkll', phoneno = 3455566567, sysdate = '3/21/2007 12:00:00 AM' where Name = 'nithi' AND age = 20 AND email = 'kfolklklklklkll' AND phoneno = 234455666";
clsGlobalFields.oledbcon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtdbsName.Text + ";persist security Info=false");
clsGlobalFields.oledbcon.Open();
clsGlobalFields.oledbcmd = new OleDbCommand(query, clsGlobalFields.oledbcon);
clsGlobalFields.oledbcmd.ExecuteNonQuery();
clsGlobalFields.oledbcon.Close();
this query is working fine.
But when i am include the sysdate in the where condition it will given the error "Type mismatch". the query is
string query="update testtable1 set Name = 'mary' , age = 20, email = 'kfolklklklklkll', phoneno = 3455566567, sysdate = '3/21/2007 12:00:00 AM' where Name = 'nithi' AND age = 20 AND email = 'kfolklklklklkll' AND phoneno = 234455666" AND sysdate = '3/21/2007 12:00:00 AM';
clsGlobalFields.oledbcon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtdbsName.Text + ";persist security Info=false");
clsGlobalFields.oledbcon.Open();
clsGlobalFields.oledbcmd = new OleDbCommand(query, clsGlobalFields.oledbcon);
clsGlobalFields.oledbcmd.ExecuteNonQuery();
clsGlobalFields.oledbcon.Close();
Plz somebody help me. i am trying the solution for that . plz sombody help me
thank u
with thanks and regards
MMary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|