V
Voyager
Hi,
I have an access table called contact with about 10 columns. I have
been trying to write code to insert a new row with no success. My eyes
are in pain!
The first row is an autonumber contactid. The following procedure
gives me an error at the line markes with <<--------- with the
message: Procedure call or argument is not valid. If you cannot solve
this problem, is there a sample procedure I can try to use... Thanks
for your help, I have been at this for a while now and VB NET help
files are a disaster.
SQL = "INSERT INTO Contact (FirstName, LastName) VALUES ('?', '?')"
Dim catDA As OleDbDataAdapter = New OleDbDataAdapter ("SELECT
FirstName, LastName FROM Contact", mDBConn)
catDA.InsertCommand = New OleDbCommand(SQL, mDBConn)
catDA.InsertCommand.CommandType = CommandType.Text
mDBConn.Open()
Dim catDS As DataSet = New DataSet
catDA.Fill(catDS)
aDataRow = catDS.Tables(0).NewRow
aDataRow.Item("FirstName") = "???"
aDataRow.Item("LastName") = "???"
catDS.Tables(0).Rows.Add(aDataRow)
catDA.Update(catDS) <<---------
I have an access table called contact with about 10 columns. I have
been trying to write code to insert a new row with no success. My eyes
are in pain!
The first row is an autonumber contactid. The following procedure
gives me an error at the line markes with <<--------- with the
message: Procedure call or argument is not valid. If you cannot solve
this problem, is there a sample procedure I can try to use... Thanks
for your help, I have been at this for a while now and VB NET help
files are a disaster.
SQL = "INSERT INTO Contact (FirstName, LastName) VALUES ('?', '?')"
Dim catDA As OleDbDataAdapter = New OleDbDataAdapter ("SELECT
FirstName, LastName FROM Contact", mDBConn)
catDA.InsertCommand = New OleDbCommand(SQL, mDBConn)
catDA.InsertCommand.CommandType = CommandType.Text
mDBConn.Open()
Dim catDS As DataSet = New DataSet
catDA.Fill(catDS)
aDataRow = catDS.Tables(0).NewRow
aDataRow.Item("FirstName") = "???"
aDataRow.Item("LastName") = "???"
catDS.Tables(0).Rows.Add(aDataRow)
catDA.Update(catDS) <<---------