DataGrid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need help in a bad way. I have a form with a datagrid in it coming for a
Access DB. I have 3 columns, StudentName, Address, Phone. I am using
Me.bindingcontext(School11, "Student") to bind buttons like first, next ect...

I have a button Add/Edit and Update to Disk and Insert
I have no idea how to code this so I can add a record to the above table.
Can someone please help me!
 
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.
 
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
 
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 NewBie,

One question - have you loaded data from the DB into the datagrid?

Regards,
Rakesh Rajan
 
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
 
Back
Top