0

hi
i'm using asp.net to create an online order form. i have 4 textboxes and i want to save the information from the textboxes to my database on click of a button.

dbName = BikeOrderdb
txtQty, txtBikeId, txtBikeName, txtPrice

Can you please help me with the code for connecting textboxes to the databases (every single statement that you can think off).
i've tried so many things but nothing worked,Please.

2
Contributors
2
Replies
5
Views
8 Years
Discussion Span
Last Post by athalia
0

You should be using SqlConnection and SqlCommand objects to do this insert.
On the button click follow the code in this link below for method Insertdata().
Your insertString will change a bit to your fields and values:

http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson03.aspx

//adjust accordingly  
string insertString = @"
                 insert into Categories
                 (BikeID,BikeName,Quantity,Price)
                 values (txtBikeId.Text, txtBikeName.Text, txtPrice.Text,txtQty.Text)";

Hope you get the idea.

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.