I am using the following code to insert a record into an online
SQL database. The MsgBox reads
"Records Inserted 1"
Is this a good way to check if the insert was successful?
If it isn't successful would should I expect?
If this isn't a good way is there a better way?
Dim ra As Integer
Dim oDate As String = "03/03/2011" 'Date.Now.ToString
Dim oText As String = "sqlclient"
Dim oNumber As Decimal = 100
Dim sSQL As String
sSQL = "Insert Into Table1 ([oDate],[oText], [oNumber]) Select '" & oDate & "' as Expr1, '" & oText & "' as Expr2, " & oNumber & " as Expr3"
myCommand = New SqlCommand(sSQL, myConnection)
ra = myCommand.ExecuteNonQuery()
'Since no value is returned we use ExecuteNonQuery
MsgBox("Records Inserted " & ra)