Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Leonel
Starting Member
10 Posts |
Posted - 2012-06-02 : 20:48:26
|
| i have a windows form with 7 textboxes, i want to insert the information from the user into the sql database, but i am having a bit of problem here is my code so far, i am getting a erroe that syas : [u]Incorrect syntax near @Date[/uPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim con As New SqlConnection("server = GX520B\SQLEXPRESS;Initial Catalog=return;Integrated Security=True") Dim cmd As New SqlCommand("insert into dbo.RMA (Rma_Number,Vendor,Device,Serial_Number,Model,Problem, Date) values (@Rma_Number,@Vendor,@Device,@Serial_Number,@Model,@Problem,@Date") cmd.Connection = con con.Open() cmd.Parameters.AddWithValue("@Rma_number", Me.TxtRMA.Text) cmd.Parameters.AddWithValue("@Vendor", Me.TxtVendor.Text) cmd.Parameters.AddWithValue("@Device", Me.TxtDevice.Text) cmd.Parameters.AddWithValue("@Serial_Number", Me.TxtSN.Text) cmd.Parameters.AddWithValue("@Model", Me.TxtModel.Text) cmd.Parameters.AddWithValue("@Problem", Me.TxtProblem.Text) cmd.Parameters.AddWithValue("@Date", Me.TxtDate.Text) Dim reader As SqlDataReader reader = cmd.ExecuteScalar() con.Close()any help would be appreciated End Sub |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-02 : 22:24:14
|
| you missed a )Dim cmd As New SqlCommand("insert into dbo.RMA (Rma_Number,Vendor,Device,Serial_Number,Model,Problem, Date) values (@Rma_Number,@Vendor,@Device,@Serial_Number,@Model,@Problem,@Date)")------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Leonel
Starting Member
10 Posts |
Posted - 2012-06-03 : 20:15:27
|
| thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-03 : 22:36:50
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|