DIGIT-ARC read-only archive · snapshot: July 23, 2026

problem with ms access connectivity in c#

2 posts · originally from https://geek.digit.in/community/threads/problem-with-ms-access-connectivity-in-c.104518/

Pragadheesh
Pragadheesh Original post #1
Dec 16, 2008 at 1:02 PM
hi,
i developed a window application(a aregistration form) and tried to store the details in a database. i used ms access. here is the method for the "submit" button that would store the details in the database. my database name is Registration and table name is Registration

private void btnRegister_Click(object sender, EventArgs e)
{

string strConnection =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\NewReg\\Registration.mdb";
OleDbConnection con = new OleDbConnection(strConnection);
string strQuery =
"select * from Registration";
OleDbCommand aCommand1 = new OleDbCommand(strQuery, con);
OleDbDataAdapter adp = new OleDbDataAdapter(aCommand1);
con.Open();
adp.SelectCommand = aCommand1;
DataSet ds = new DataSet();
adp.Fill(ds, "Registration");
DataRow drow = ds.Tables[0].NewRow();
drow[0] = txtName.Text;

drow[1] = int.Parse(txtAge.Text);

drow[2] = txtGender.Text;

drow[3] = txtPassword.Text;

drow[4] = int.Parse(txtContact.Text);
drow[5] = txtMail.Text;
ds.Tables[0].Rows.Add(drow);

OleDbCommandBuilder builder = new OleDbCommandBuilder(adp);

adp.UpdateCommand = builder.GetUpdateCommand();
adp.Update(ds);

con.Close();


}

but i get exceptions stating "syntax insert into exception". why such an exception? help plz.
also i'm not much familiar with MS connectivity using C#. any sites or links from which i can learn more about it..
dheeraj_kumar
Dec 17, 2008 at 6:47 PM
*www.google.com/search?num=100&hl=e...9G&q=access+connectivity+using+C#&btnG=Search
*www.google.com/search?client=opera...tion&sourceid=opera&num=100&ie=utf-8&oe=utf-8

Please search before posting.