UPDATE command

dobbs
06-12-2006, 11:24 AM
I am using the following code to update my Access database, but it is not updating the values. I do not get any errors and it steps through the code fine. Can anyone see a syntax error that I might have?


Dim connDriver As String = "Provider=Microsoft.Jet.OLEDB.4.0;"
Dim connFile As String = "Data Source=" & sPGDBPath & ";"
Dim sSQL As String
Dim i As Integer

dataTable = New Data.OleDb.OleDbConnection(connDriver & connFile)
dataTable.Open()

For i = 0 To lstSelected.Items.Count - 1

sSQL = "UPDATE subinfo SET rules = '" & ruleStr & "'"

dataCmd = New Data.OleDb.OleDbCommand(sSQL, dataTable)
dataCmd.ExecuteNonQuery()

Next

dataTable.Close()


Thanks!

PrOpHeT
06-12-2006, 01:41 PM
Only that without a where clause on the update, you would be setting every field in subinfo.rules to rulestr lstSelected.Items.Count - 1 times. I do not see where the lstSelected loop is even relevant to the query? :confused:

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum