我的数据库中有一个表,其中有一个布尔字段。我想检查它的值并进一步使用它来删除另一个表中的记录......
虚拟代码是这样的:
private sub del_Machine()
Dim machine_srno as string
Dim asql As String = ("SELECT * FROM Installation_det")
cnnOLEDB.Open()
Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand(asql, cnnOLEDB)
Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader
If dr.Read = True Then
if IsTFT.checked=true then ----------> IsTFT is a column in Installation_det table
machine_srno=Machine.value ------------> Machine is also a field in database
DeleteQuery = "DELETE * FROM new_table WHERE sr_no=@mach_srno"
Dim cmd As OleDb.OleDbCommand = New OleDb.OleDbCommand(DeleteQuery, cnnOLEDB)
cmd.Parameters.AddWithValue("@mach_srno", machine_srno)
cmd.ExecuteNonQuery()
end sub
请帮助我进行实际编码...我认为这对数据表和数据集很有帮助,但不知道如何使用它..请给我建议代码...谢谢..