Query is corrupt

  • Thread starter Thread starter gwboolean
  • Start date Start date
G

gwboolean

Guest
This message is a new one to me.

1514534.jpg

Public Sub IncrementEventID()
'Increment ID number and assign to global variable
Dim strEventID As String = CStr(_strEventMasterID)
Dim intEventID As Integer = CInt(Mid(strEventID, 3, 8))
intEventID += 1
strEventID = "EV" + CStr(intEventID)
Try
'Open Connection and establish Command object
FileIDConn.MasterBaseOpen()
Dim FileIDTable As DataTable = New DataTable
FileIDCommand = New OleDbCommand("Select chrEventID From setEventID", FileIDConn.MasterBaseConnection)
FileIDAdapter = New OleDbDataAdapter()
FileIDAdapter.SelectCommand = FileIDCommand
Dim FileIDBuild As OleDbCommandBuilder = New OleDbCommandBuilder(FileIDAdapter)
FileIDAdapter.Fill(FileIDTable)
'Replace ChangeID value in table
FileIDBindingSource.DataSource = FileIDTable
FileIDTable.Rows(0).Item(0) = CStr(strEventID)
FileIDBindingSource.EndEdit()
FileIDAdapter.Update(FileIDTable)
FileIDConn.MasterBaseClose()
FileIDCommand.Dispose()
FileIDAdapter.Dispose()
FileIDTable.Dispose()
Catch ex As Exception
MessageBox.Show("Failed to update Event ID." + ControlChars.CrLf + ex.Message, "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try
End Sub

The exeception is executed at the FileIDTable.Update() line. My understanding of the error message is that there is something wrong in query contained in FileIDCommand.

While this is probably very obvious, I just don't get it.


Oh yeah, I use this code to increment an ID number.



gwboolean

Continue reading...
 

Similar threads

Back
Top