Re: what am I doing wrong ?
- From: "Cor Ligthert [MVP]" <notmyfirstname@xxxxxxxxx>
- Date: Fri, 10 Nov 2006 05:42:40 +0100
Slimshin,
Your code is not complete to update, you can add this,
OleDbConnection con;try
{
OleDbDataAdapter dbad;SQLCommandBuilder cmd = new SQLCommandBuilder();
DataSet ds;
DataRow dr;
con = new
OleDbConnection(testacc.Properties.Settings.Default.mytestConnectionString);
dbad = new OleDbDataAdapter("select * from who",con);
ds = new DataSet();
dbad.Fill(ds, "who");
dr=ds.Tables["who"].NewRow();
dr["name"] = "Joe";
dr["adress"] = "123 anystreet";
dr["age"] = 25;
ds.Tables["who"].Rows.Add(dr);
cm = cmd(OleDBbDataAdapter);
OleDbDataAdapter.Fill(ds);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finnaly
{
con.close;
}
Now you can see what goes wrong if that still happen (I have typed this
direct in this message and did a long time not use the commandbuilder).
As it is working you can refactor your code, by instance using "using" for
the connection does make it look nicer.
I hope this helps,
Cor
con.Close();
.
- Prev by Date: Re: How to fire an event
- Next by Date: Re: Problem in TableAdapters
- Previous by thread: Re: what am I doing wrong ?
- Next by thread: Re: what am I doing wrong ?
- Index(es):
Relevant Pages
|