Re: Add new row to Access database by Miha
Miha
Wed Jan 21 04:12:16 CST 2004
Hi,
The dataadapter is responsible for communication with database and
insertcommand is used by adapter for doing inserts.
DataSet only holds data, nothing more.
Check out
Introduction to Data Adapters
.net help topic
--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com
"kids" <someone@microsoft.com> wrote in message
news:%233kMxQA4DHA.416@TK2MSFTNGP10.phx.gbl...
> I don't have dataadapter.insertcommand.
> Do I need one?
> Can't I update the source table from DataSet?
>
>
> "Miha Markic" <miha at rthand com> wrote in message
> news:Os2FsEA4DHA.2404@TK2MSFTNGP12.phx.gbl...
> > Hi kids,
> >
> > How does your dataadapter.insertcomand lookl like?
> >
> > --
> > Miha Markic - RightHand .NET consulting & software development
> > miha at rthand com
> > www.rthand.com
> >
> > "kids" <someone@microsoft.com> wrote in message
> > news:eTcM6z73DHA.3216@TK2MSFTNGP11.phx.gbl...
> > > Hi all,
> > >
> > > I wrote a simple application using C# & Ms. Access DB.
> > > 1. Read all record from database into dataset and perform searching
> > > functionality. (work)
> > > 2. I want to add new record into the database if searching fail.
> (problem)
> > > Here is the procedure:
> > > MyTable has 2 columns only (myKey | myValue) where myKey is the PK and
> > > myValue column is allow null.
> > > ...C# coding
> > > private OleDbDataAdapter da;
> > > private DataSet dsMyTable;
> > >
> > > AddRow(string newKey){
> > > DataTable dt = dsMyTable.Tables["MyTable"];
> > > DataRow irow = dt.NewRow();
> > > irow[0] = newKey;
> > > dt.Rows.Add(irow);
> > > da.Update(dsMyTable,"MyTable");
> > > }
> > >
> > > there was no error.
> > > But when I check in MyTable I couldn't find new record added ??!!!
> > >
> > > Please advices,
> > > Sokun
> > >
> > >
> >
> >
>
>