connect an asp.net page to the SQL server database(visual studio 2010) -


i have asp.net page in have 2 textboxes named username , password , want when press login button, dataprovided in text boxes should inserted in database table. have created table named admin_login , give columns , given

insert admin_login values(" .........") 

and provided connection string in class file still having problem in inserting data in database.

do need put connection string in place in web.config file or doing else wrong?

sqlconnection con= new sqlconnection("data source=server name; initial catalog=database name; integrated security=true");      sqlcommand cmd = new sqlcommand("insert admin (username,password)values('"+textbox1.text+"','"+textbox2.text+"')",con);     cmd.commandtype= commandtype.text;      con.open();     cmd.executenonquery();     con.close(); 

try code use namespace system.sqlclient;


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -