O
Oluwole Kolawole
Hi all,
I need another set of eyes to look at a problem I'm having. I'm trying to
insert data into a Micrsoft Access 2002 table using the following SQL
statement (all fields are Text):
"Insert Into Customers (UserName, Password, FirstName, LastName, Address,
PostCode, PhoneDay, PhoneEve, PhoneMob) Values ('Jack', 'beanstalk', 'Jack',
'Beanstalk', 'Nowhere', 'Nothing', '00000000', ' ', ' ')"
As far as I can tell, there is absolutely nothing wrong with this Insert
statement but ADO.Net thinks different and I keep getting a "Syntax error in
INSERT INTO statement" error. The code I'm using is as follows:
bool AllOk = true;
RowsAffected = 0;
try
{
OleDbConnection cn = new OleDbConnection(cnString());
cn.Open();
OleDbCommand cmd = new OleDbCommand(SQLstmt, cn);
RowsAffected = cmd.ExecuteNonQuery(); <----THIS DOESN'T WORK
cn.Close();
cn.Dispose();
cn = null;
cmd.Dispose();
cmd = null;
}
catch (Exception e)
{AllOk = false;}
I'm getting desperate, can anyone tell me what I'm doing wrong.
Regards.
Wole
London.
--
===============================
Life is not fair, get used to it!
God is fair, get Him!
I need another set of eyes to look at a problem I'm having. I'm trying to
insert data into a Micrsoft Access 2002 table using the following SQL
statement (all fields are Text):
"Insert Into Customers (UserName, Password, FirstName, LastName, Address,
PostCode, PhoneDay, PhoneEve, PhoneMob) Values ('Jack', 'beanstalk', 'Jack',
'Beanstalk', 'Nowhere', 'Nothing', '00000000', ' ', ' ')"
As far as I can tell, there is absolutely nothing wrong with this Insert
statement but ADO.Net thinks different and I keep getting a "Syntax error in
INSERT INTO statement" error. The code I'm using is as follows:
bool AllOk = true;
RowsAffected = 0;
try
{
OleDbConnection cn = new OleDbConnection(cnString());
cn.Open();
OleDbCommand cmd = new OleDbCommand(SQLstmt, cn);
RowsAffected = cmd.ExecuteNonQuery(); <----THIS DOESN'T WORK
cn.Close();
cn.Dispose();
cn = null;
cmd.Dispose();
cmd = null;
}
catch (Exception e)
{AllOk = false;}
I'm getting desperate, can anyone tell me what I'm doing wrong.
Regards.
Wole
London.
--
===============================
Life is not fair, get used to it!
God is fair, get Him!