OleDbDataAdapter o = new OleDbDataAdapter("select * from tblExam1", conn);
                DataSet ds = new DataSet();
                o.Fill(ds, "tblExam1");
                DataRow r = ds.Tables["tblExam1"].NewRow();
                r["exam1ID"]=324;
                r["patID"] = patid;
                r["ypsos"] = 32;
                ds.Tables["tblExam1"].Rows.Add(r);
                ds.AcceptChanges();

no error message. execute code normally, but row did not inserted in db what i m missing? its access db using from asp.net

Recommended Answers

All 4 Replies

OleDbDataAdapter o = new OleDbDataAdapter("select * from tblExam1", conn);
DataSet ds = new DataSet("tblExam1");
o.Fill(ds, "tblExam1");
DataRow r = ds.Tables["tblExam1"].NewRow();
r["exam1ID"]=324;
r["patID"] = patid;
r["ypsos"] = 32;
ds.Tables["tblExam1"].Rows.Add(r);
r.Update(ds, "tblExam1");
ds.AcceptChanges();


You just forgot the update statement & if possible give name to the dataset as i did....

OleDbDataAdapter o = new OleDbDataAdapter("select * from tblExam1", conn);
DataSet ds = new DataSet("tblExam1");
o.Fill(ds, "tblExam1");
DataRow r = ds.Tables["tblExam1"].NewRow();
r["exam1ID"]=324;
r["patID"] = patid;
r["ypsos"] = 32;
ds.Tables["tblExam1"].Rows.Add(r);
r.Update(ds, "tblExam1");
ds.AcceptChanges();


You just forgot the update statement & if possible give name to the dataset as i did....

thanks, its solved by ur help,

if it helped you my friend mark it as solved.....

Hi

You can refer following code for row inserting.

insert into recon values(1,'sri',-1,'20090806');

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.