hi I am working on an application that manages the data in a access database. but i cant seem to get past this error.
When i try to run it it says:
"Syntax error in INSERT INTO statement" syntax error, I have made all the fields in database TEXT(255) so it cant be that.
any help regarding this will be much appreciated, i am new to datasets and would love any help or guides i can get on the matter.
My using statements:
any help would be much appreciated
When i try to run it it says:
"Syntax error in INSERT INTO statement" syntax error, I have made all the fields in database TEXT(255) so it cant be that.
any help regarding this will be much appreciated, i am new to datasets and would love any help or guides i can get on the matter.
Code:
string connstring = "Provider=Microsoft.Jet.OleDb.4.0;" + @"Data Source=" + DBpath + ";" + "Jet OLEDB:Database Password=password;"; OleDbConnection conn = new OleDbConnection(connstring); conn.Open(); OleDbDataAdapter dba = new OleDbDataAdapter("Select * FROM Teachers", conn); OleDbCommandBuilder cmdBuilder = new OleDbCommandBuilder(dba); DataSet ds = new DataSet(); dba.Fill(ds, "Teachers"); DataTable dt = ds.Tables["Teachers"]; DataRow studentRow = dt.NewRow(); studentRow["TeachNo"] = "2"; studentRow["TName"] = textBox1.Text; studentRow["TSurname"] = textBox2.Text; studentRow["Gender"] = comboBox1.Text; studentRow["Age"] = textBox3.Text; studentRow["Cell-No"] = textBox6.Text; studentRow["Tell-No"] = textBox5.Text; studentRow["Suburb"] = textBox9.Text; studentRow["Street-address"] = textBox11.Text; studentRow["E-Mail"] = textBox13.Text; dt.Rows.Add(studentRow); dba.Update(ds, "Teachers"); conn.Close(); //Save to Teacher
Code:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.OleDb;