=============== code add to database
Try
If (con.State = ConnectionState.Open) Then
con.Close()
End If
cmd.CommandType = System.Data.CommandType.Text
cmd.CommandText = "Insert Into dbo.tbCar values ('" & txtModel.Text & "','" & txtYear.Text & "'," & txtPrice.Text & "," & txtQty.Text & ")"
cmd.Connection = con
con.Open()
cmd.ExecuteNonQuery()
strQ = "SELECT * FROM tbCar ORDER BY [Model]"
load_data(strQ)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
=============================
No comments:
Post a Comment