C
christing
Guest
Dim cmd As New OleDb.OleDbCommand
If Not app.State = ConnectionState.Open Then
'open connection if it is not yet open
app.Open()
End If
cmd.Connection = app
'check whether add new or update
If Me.txtID.Tag & "" = "" Then
'add new
'add data to table
cmd.CommandText = "INSERT INTO ADMIN(CusID,Name) " & _
" VALUES('" & Me.txtID.Text & "','" & Me.txtname.Text & "')"
cmd.ExecuteNonQuery()
Else
'update data in table
cmd.CommandText = "UPDATE ADMIN " & _
" SET ID=" & Me.txtID.Text & _
", Name='" & Me.txtname.Text & "'" & _
" WHERE ID=" & Me.txtID.Tag
cmd.ExecuteNonQuery()
End If
'refresh data in list
RefreshData()
'clear form
Me.btnclear.PerformClick()
'close connection
app.Close()
I GET Option Strict On prohibits operands of type Object for operator '&'. on this code (If Me.txtID.Tag & "" = "" Then) and (" WHERE ID=" & Me.txtID.Tag)
Continue reading...
If Not app.State = ConnectionState.Open Then
'open connection if it is not yet open
app.Open()
End If
cmd.Connection = app
'check whether add new or update
If Me.txtID.Tag & "" = "" Then
'add new
'add data to table
cmd.CommandText = "INSERT INTO ADMIN(CusID,Name) " & _
" VALUES('" & Me.txtID.Text & "','" & Me.txtname.Text & "')"
cmd.ExecuteNonQuery()
Else
'update data in table
cmd.CommandText = "UPDATE ADMIN " & _
" SET ID=" & Me.txtID.Text & _
", Name='" & Me.txtname.Text & "'" & _
" WHERE ID=" & Me.txtID.Tag
cmd.ExecuteNonQuery()
End If
'refresh data in list
RefreshData()
'clear form
Me.btnclear.PerformClick()
'close connection
app.Close()
I GET Option Strict On prohibits operands of type Object for operator '&'. on this code (If Me.txtID.Tag & "" = "" Then) and (" WHERE ID=" & Me.txtID.Tag)
Continue reading...