Newbie Question

G

Guest

I need help:

I want to add a new row to an Access Table "Table1"
with its default values, but it doesn't work at all.

Here is the code:

Dim Adapter As OleDb.OleDbDataAdapter
Dim Dataset As New Data.DataSet
Dim DataTable As New Data.DataTable
Dim DataRow As System.Data.DataRow

Adapter = New OleDb.OleDbDataAdapter("SELECT * FROM Table1", Connection)
Adapter.Fill(Dataset, "Table1")

DataTable = Dataset.Tables( "Table1")
DataRow = DataTable.NewRow

DataTable.Rows.Add(DataRow)

Adapter.Update(Dataset, "Table1")
 
K

Kris Desmadryl

What do you want to do ?
Insert a record ?
If so, you didn't define an insert statement on the adapter (you could use
the CommandBuilder)
You also don't set any data for the DataRow

Kris.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top