Connecting Tech Pros Worldwide Forums | Help | Site Map

saving data from web from to a database

Newbie
 
Join Date: Jun 2007
Posts: 1
#1: Jun 2 '07
Hi!
I really need help with this asap. I need to capture users' input and save it to a database, to the table previously created!How do I do this?
Also, is there any way I can save this directly to Excel file, because I will need to do calculation with those number that I capture anyway?? Thank you,
Laki

Newbie
 
Join Date: May 2007
Posts: 10
#2: Jun 5 '07

re: saving data from web from to a database


suppose you have two text box and a submit button and you want to save the data that are written in text box to your SQL databse then do this...
table name:-student
and fields are roll no. and name.

button_click()
{
//for roll no.
int num=convert.toInt32(Textbox1.Text);
sqlconnection con=new sqlconnection("uid=sa;pwd=sa;database=northwind;se rver=.");
sqlcommand com=new sqlcommand("insert into student values("+num+",'"+Textbox2.Text+"')",con);
com.connection.open();
com.ExecuteNonquery();
Textbox1.Text="";
Textbox2.Text="";
com.connection.close();
}
Reply