Writing to database from application

  • 14 years ago

    Im tryin to develop a shopping application so that a user can select checkboxes of items they wish to order then click on an order button. Once they have clicked on the order button if the checkbox is checked then i want it to write the name of the checkbos plus ut's associated price and quatitiy (textbox1 and texbox3 in the code). Below is the ocde associated with my order button. It compiles ok and runs without any errors but when i check the database it hasn't entered any of the details. Any one know why?

    If Chicken.CheckState = 1 Then
                cnPurchases.Open()
                SQLPurchases.Connection = cnPurchases
                SQLPurchases.CommandText = "INSERT INTO Purchases " & "(Item, Price, Quantity)" & "Values (" & Chicken.Text & ", " & TextBox1.Text & ", " & TextBox3.Text & ")"
                cnPurchases.Close()



            End If

    Thanks

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debuggers don't remove bugs. They only show them in slow motion.”