您可能会尝试声明这是重复的,但就我搜索堆栈溢出和一些搜索引擎而言,我已经意识到它们都没有解决我的问题,所以这是我的代码:
这是我的保存按钮
If chkPic.CheckState = CheckState.Checked Then
myr.Close()
mycom.CommandText = "Insert into tbl_employee(Picture) values (Ok) where LastName = '" & txtLastName.Text & "' AND FirstName = '" & txtFirstName.Text & "' AND MiddleName = '" & txtMiddleName.Text & "' "
myr = mycom.ExecuteReader
End If
这是我的更新按钮
If chkPic.Checked Then
myr.Close()
mycom.CommandText = "Update tbl_employee set Picture = '& Ok &' where LastName='" & txtLastName.Text & "' and FirstName='" & txtFirstName.Text & "' and MiddleName='" & txtMiddleName.Text & "' "
myr = mycom.ExecuteReader
myr.Close()
Else
myr.Close()
mycom.CommandText = "Update tbl_employee set Picture = '' where LastName='" & txtLastName.Text & "' and FirstName='" & txtFirstName.Text & "' and MiddleName='" & txtMiddleName.Text & "' "
myr = mycom.ExecuteReader
myr.Close()
End If
我还想考虑如何在我丢失的焦点事件中读取其数据,我编码为:
If myr(75) = "Ok" Then
chkPic.CheckState = CheckState.Checked
Else
chkPic.CheckState = CheckState.Unchecked
End If
请任何人帮忙..谢谢