Updating records

  • Thread starter Thread starter lmnorms1
  • Start date Start date
L

lmnorms1

Hello,
I am trying to update records on a table. I keep the unique ID in a
table array so I can read the array and update the corresponding
record. The code is giving me an unhandled exception in the
command.executenonquery()

Here is the code
Dim xcnt As Integer

Dim gConnString As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Customer
development\VBNET\CSFV\CSFV.mdb;"
Dim Conn As New OleDbConnection(gConnString) 'Actual
Connection to database.
Conn.Open()

For xcnt = 0 To pcnt - 1
Dim xstr As String
xstr = printtable(xcnt)
Dim SqlStatement As String = "UPDATE * from LetterData " &
_
"Set DateSenttoPrint = #" & shtDt & "# " &
_
"WHERE ID = " & xstr & ";"

Dim Command As New OleDbCommand(SqlStatement, Conn)
Command.ExecuteNonQuery()
'close db

Next

Conn.Close()


Any advice would be apprieciated.

Thank you,
Lmnorms1
 
Back
Top