I have this code that Deletes a record by its IP address inputted by the user. How do you check if that record is available? how do evaluate first that the IP address inputted is not in the database before deleting anything? in vb 6.0 I used to do this line:
If rs.EOF And rs.BOF Then
but it doesn't work anymore in vb 2008
delete IP Code:
If TextBox1.Text = "" Then MsgBox("Input IP Address", MsgBoxStyle.OkOnly, Title:="") Else Dim myConnection As OleDbConnection = New OleDbConnection Dim myCommand As OleDbCommand = New OleDbCommand myConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Network_Info.mdb" myConnection.Open() myCommand.Connection = myConnection myCommand.CommandText = "DELETE * from Computer_Connection_Info WHERE IP_Address ='" & TextBox1.Text & "'" myCommand.ExecuteNonQuery() End If




Reply With Quote