I have a "small" problem. Namely, I want to delete data associated with p_ID value from a table. Before of that, I'm trying to check is there data which should be deleted or not.
I'm getting an error: "no value given for one or more required parameters". IF I understood that correctly, that's because my SQL returns no value. How's the best way to solve this kind of troubles?
Thanks in advance
vb Code:
Dim amnt As integer Using cn As New OleDb.OleDbConnection _ (db_path) cn.Open() Dim cmd As New OleDb.OleDbCommand("Select * FROM cards WHERE ID = """ & p_ID & """", cn) amnt = cmd.ExecuteScalar() End Using If amnt = 0 Then Exit Sub Else Dim myConn As sqlConn = New sqlConn() myConn.KonektujBazu("Delete From cards WHERE ID = """ & p_ID & """") myConn.OLEComm.Connection = myConn.OLEConn myConn.OLEComm.ExecuteNonQuery() myConn.OLEConn.Close() end if End Sub
I'm getting an error: "no value given for one or more required parameters". IF I understood that correctly, that's because my SQL returns no value. How's the best way to solve this kind of troubles?
Thanks in advance