Dim intNumrow As Integer
Dim strsql As String
strsql = "Select Count(*) from GoodsCheck Where goodsID='" & Me.txtgoodsid.Text & "' And room='" & Me.cbbroom.Text & "'"
conn.Open()
cm = New SqlCommand(strsql, conn)
intNumrow = cm.ExecuteScalar()
conn.Close()
If intNumrow > 0 Then
Dim strcon3 As String
strcon3 = "Update GoodsCheck Set sumAmount='" & i2.ToString & "' Where goodsID='" & Me.txtgoodsid.Text & "' And room='" & Me.cbbroom.Text & "'"
conn.Open()
cm = conn.CreateCommand()
With cm
.CommandText = strcon3
.CommandType = CommandType.Text
.ExecuteNonQuery()
End With
conn.Close()
Else
Dim strcon4 As String
strcon4 = "Insert into GoodsCheck (goodsID,room,sumAmount) Values ('" & txtgoodsid.Text & "' , '" & cbbroom.Text & "', '" & txtOutamount.Text & "')"
conn.Open()
cm = conn.CreateCommand()
With cm
.CommandText = strcon4
.CommandType = CommandType.Text
.ExecuteNonQuery()
End With
conn.Close()
End If