Hello EveryBody,
The code below encounter error when no record is existing on the table. Do I need To make another query to determine if the record exist before issuing the SQL delete command ? Thank U.
VB Code:
Public Function DeleteCreditCard(ByVal xBranchCode As String, ByVal xTrans_No As String) As String Dim objKeyCommand As SqlCommand Dim objConn As SqlConnection Dim objDA As SqlDataAdapter Dim strSQL As String objConn = New SqlConnection("SERVER=SirlitzServer;Database=dbSirlitz;UID=sa") objKeyCommand = New SqlCommand strSQL = "DELETE FROM arCreditCard WHERE BranchCode = '" & CInt(xBranchCode) & "' AND Trans_No = '" & CInt(xTrans_No) & "'" objConn.Open() objKeyCommand.CommandText = strSQL objKeyCommand.CommandType = CommandType.Text objKeyCommand.Connection = objConn objKeyCommand.ExecuteNonQuery() objKeyCommand = Nothing objConn.Close()




Reply With Quote