Hi, if anyone could help, id be mightly greatful, Im a beginner at this stuff so not the most experienced but Im starting to get my head round things in VB.
Anyhow Im getting the error thats above:
Object variable or With block variable not set.
wehn trying to delete a single record from a table: here is the current code i have trying to achieve this operation:
sql = "Delete from Fault where TechID='" & TechIDM & "'"
Dim commandDelete As New OdbcCommand(sql)
Using connection As New OdbcConnection(constring)
commandDelete.Connection = connection
connection.Open()
commandDelete.ExecuteNonQuery()
connection.Close()
End Using
'Messagebox to give secure check to user about deleting data
If MsgBox("Are you sure you wish to proceed?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
commandDelete.Connection = connection
connection.Open()
commandDelete.ExecuteNonQuery()
connection.Close()
End If
error comes up on highlighted text. if anyone can shed some light on this id be so greatful, thank you to anyone who can help
Cheers
Anyhow Im getting the error thats above:
Object variable or With block variable not set.
wehn trying to delete a single record from a table: here is the current code i have trying to achieve this operation:
sql = "Delete from Fault where TechID='" & TechIDM & "'"
Dim commandDelete As New OdbcCommand(sql)
Using connection As New OdbcConnection(constring)
commandDelete.Connection = connection
connection.Open()
commandDelete.ExecuteNonQuery()
connection.Close()
End Using
'Messagebox to give secure check to user about deleting data
If MsgBox("Are you sure you wish to proceed?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
commandDelete.Connection = connection
connection.Open()
commandDelete.ExecuteNonQuery()
connection.Close()
End If
error comes up on highlighted text. if anyone can shed some light on this id be so greatful, thank you to anyone who can help
Cheers