J
Jazper
Hi i got a big problem and don't know how to solve it...
i have an access DB and try to insert a new record!
Fild1: ID - Numeric - PrimaryKey
Fild2: User - Text
//---My ConnectionString----------------------------------
Application["OleConStr"]
= "Provider=Microsoft.Jet.OLEDB.4.0;Mode=Share Deny None;"
+ @"Data Source=C:\db\jaz.mdb";
//---My Code for Select----------------------------------
//---(works great)---------------------------------------
OleDbCommand cmdS = new OleDbCommand("Select *
from jaz_test", this.con);
OleDbDataReader rd = cmdS.ExecuteReader();
while( rd.Read() )
Response.Write(rd["ID"].ToString() + "-" +
rd["User"].ToString());
rd.Close();
cmdS.Dispose();
//RESULT = 1-Webmaster
//RESULT = 2-Webmaster II
//---My Code for Insert (Exception raises)--------------
OleDbCommand cmdI = new OleDbCommand("INSERT INTO
jaz_test(ID, User) VALUES(3, 'UserX')", this.con);
cmdI.ExecuteNonQuery();
cmdI.Dispose();
//---My Problem!----------------------------------
cmdI.ExecuteNonQuery() throws Exception "Syntax error in
INSERT INTO statement."
WHERE is the Error?. SQL-Insert statement must be OK! when
i execute it in Access itself, it works great! When i
execute it by VB6 it works great! When i execute it in C++
it works great! BUT NOT IN DOTNET with OleProvider!
What is the problem...?
Thanx for every hint!
Jazper
i have an access DB and try to insert a new record!
Fild1: ID - Numeric - PrimaryKey
Fild2: User - Text
//---My ConnectionString----------------------------------
Application["OleConStr"]
= "Provider=Microsoft.Jet.OLEDB.4.0;Mode=Share Deny None;"
+ @"Data Source=C:\db\jaz.mdb";
//---My Code for Select----------------------------------
//---(works great)---------------------------------------
OleDbCommand cmdS = new OleDbCommand("Select *
from jaz_test", this.con);
OleDbDataReader rd = cmdS.ExecuteReader();
while( rd.Read() )
Response.Write(rd["ID"].ToString() + "-" +
rd["User"].ToString());
rd.Close();
cmdS.Dispose();
//RESULT = 1-Webmaster
//RESULT = 2-Webmaster II
//---My Code for Insert (Exception raises)--------------
OleDbCommand cmdI = new OleDbCommand("INSERT INTO
jaz_test(ID, User) VALUES(3, 'UserX')", this.con);
cmdI.ExecuteNonQuery();
cmdI.Dispose();
//---My Problem!----------------------------------
cmdI.ExecuteNonQuery() throws Exception "Syntax error in
INSERT INTO statement."
WHERE is the Error?. SQL-Insert statement must be OK! when
i execute it in Access itself, it works great! When i
execute it by VB6 it works great! When i execute it in C++
it works great! BUT NOT IN DOTNET with OleProvider!
What is the problem...?
Thanx for every hint!
Jazper