Hi,
I assume that you have a datagrid, and a dataset populated by a dataadapter
with data from the DB, and that any existing data in the DB is shown in it.
For updating the DB, just edit any existing row.
In order to insert, insert a new value in the row with a '*'.
Within the handlers for Update and Add button click events, call the
dataadapter's Update method, passing the dataset you use.
Let me know if you still have problems.
HTH,
Rakesh Rajan
> I have my datagrid setup, I can see my table in my form and I have added a
> connection and cfg the adapter. Now I need to add data to it from a btnAdd.
[quoted text clipped - 21 lines]
> > > I have no idea how to code this so I can add a record to the above table.
> > > Can someone please help me!
NewBie - 15 Oct 2004 19:19 GMT
You are right in you assumption. I do have a DB that have existing data. I
have no clue how to do ''call the dataadapter's Update method, passing the
dataset you use."
The book I am using does not give me any info on how call the adapter.
> Hi,
>
[quoted text clipped - 37 lines]
> > > > I have no idea how to code this so I can add a record to the above table.
> > > > Can someone please help me!
Rakesh Rajan - 15 Oct 2004 19:31 GMT
Hi NewBie,
One question - have you loaded data from the DB into the datagrid?
Regards,
Rakesh Rajan
> You are right in you assumption. I do have a DB that have existing data. I
> have no clue how to do ''call the dataadapter's Update method, passing the
[quoted text clipped - 42 lines]
> > > > > I have no idea how to code this so I can add a record to the above table.
> > > > > Can someone please help me!
NewBie - 15 Oct 2004 19:39 GMT
Yes I did using the fill method.
> Hi NewBie,
>
[quoted text clipped - 49 lines]
> > > > > > I have no idea how to code this so I can add a record to the above table.
> > > > > > Can someone please help me!
Rakesh Rajan - 15 Oct 2004 20:15 GMT
Hi,
OK.
Make sure that both the adapter, and dataset is declared within the class
scope and not in a method. For this, just make sure that their declarations
are somewhere within the class definition but not within any method.
Now add an event handler to the Add button (double click on the Add button
in design time to do this). Within the handler, call the dataadapter's Update
method, passing the dataset name.
For eg:
myDataAdapter.Update(myDataSet);
, which assumes that 'myDataAdapter' is my dataadapter and 'myDataSet' is
the dataset.
Let me know if you need more help.
Regards,
Rakesh Rajan
> Yes I did using the fill method.
>
[quoted text clipped - 51 lines]
> > > > > > > I have no idea how to code this so I can add a record to the above table.
> > > > > > > Can someone please help me!
NewBie - 15 Oct 2004 20:59 GMT
I will have to try it tonight due to I am at work now. And thanks for all
your help :)
> Hi,
>
[quoted text clipped - 72 lines]
> > > > > > > > I have no idea how to code this so I can add a record to the above table.
> > > > > > > > Can someone please help me!
Rakesh Rajan - 15 Oct 2004 21:05 GMT
Anytime NewBie :)
Let me know your progress.
Regards,
Rakesh Rajan
> I will have to try it tonight due to I am at work now. And thanks for all
> your help :)
[quoted text clipped - 75 lines]
> > > > > > > > > I have no idea how to code this so I can add a record to the above table.
> > > > > > > > > Can someone please help me!