2
Answers

add a new row, what do i wrong?

gamedev

gamedev

20y
1.9k
1
I'm tring to add a row at my database .mdb but i get the follow error: "Sintax error in the INSERT INTO instruction" why? what do i wrong? this is the schema of my database: Nome: text 15 Domanda: text 20 Risposta: text 15 Email: text 20 this is the code: System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(); conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data source= myDatabase.mdb;"; try { conn.Open(); OleDbDataAdapter myAdapter = new OleDbDataAdapter("SELECT * FROM myTable", conn); OleDbCommandBuilder myCmd = new OleDbCommandBuilder(myAdapter); DataSet myDataSet = new DataSet("myTable"); myAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey; myAdapter.Fill(myDataSet, "myTable"); DataRow myRow = myDataSet.Tables["myTable"].NewRow(); myRow["Nome"] = mNuovoUtente.mName; myRow["Domanda"] = mNuovoUtente.mQuestion; myRow["Risposta"] = mNuovoUtente.mAnswer; myRow["Email"] = mNuovoUtente.mEmail; myDataSet.Tables["TabellaUtente"].Rows.Add(myRow); myAdapter.Update(myDataSet, "myTable"); catch(Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); }
Answers (2)
0
Satyapriya Nayak
NA 53k 8m 12y
Hi Manish,


Please refer the below links

http://strictlysql.blogspot.in/2010/11/lock-escalation-sql-server-2008.html

http://msdn.microsoft.com/en-us/library/ms184286%28v=sql.105%29.aspx

http://aboutsqlserver.com/2012/01/11/locking-in-microsoft-sql-server-part-12-lock-escalation/



Thanks