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.

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.

Hey guru, thanks. you helped me a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.