| | |
insert into a DATABASE
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Mar 2007
Posts: 35
Reputation:
Solved Threads: 1
hi i am using visual studio 2008 express edition. i have created a database in sql ( add new item > sql database). the db has 2 fields uname and upwd.
have also created a web page in asp.net that has 2 text boxes (textbox1,textbox2) and a command button (cmdbutton1). i want to insert the values entered by the user into the database that ive created on the click event of the button..Please provide me the code to do thye above mentioned..
Regards,
Bharat Shivram
have also created a web page in asp.net that has 2 text boxes (textbox1,textbox2) and a command button (cmdbutton1). i want to insert the values entered by the user into the database that ive created on the click event of the button..Please provide me the code to do thye above mentioned..
Regards,
Bharat Shivram
•
•
Join Date: Oct 2008
Posts: 32
Reputation:
Solved Threads: 4
using System;
using System.Data;
using System.Data.SqlClient;
string sConnectionString = "Integrated Security=SSPI;Initial Catalog=;Data Source=localhost;";
SqlConnection objConn = new SqlConnection(sConnectionString);
objConn.Open();
string sSQL = "INSERT INTO Users (uname,upwd) VALUES ('" + textbox1.Text + "','" + textbox2.Text + "')";
SqlCommand objCmd = new SqlCommand(sSQL,objConn);
objCmd.ExecuteNonQuery();
using System.Data;
using System.Data.SqlClient;
string sConnectionString = "Integrated Security=SSPI;Initial Catalog=;Data Source=localhost;";
SqlConnection objConn = new SqlConnection(sConnectionString);
objConn.Open();
string sSQL = "INSERT INTO Users (uname,upwd) VALUES ('" + textbox1.Text + "','" + textbox2.Text + "')";
SqlCommand objCmd = new SqlCommand(sSQL,objConn);
objCmd.ExecuteNonQuery();
![]() |
Similar Threads
- MSSql 2000 Unable to insert into database (MS SQL)
- database update using excell (Windows NT / 2000 / XP)
- insert values to mysql database (JSP)
- Please help(Problem in insertion data to database) (JSP)
- insert database (ColdFusion)
- How to Hash and Store in Database (ASP.NET)
- Interface page for my new database... (MySQL)
- adding a database to my webpage (PHP)
Other Threads in the ASP.NET Forum
Views: 934 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 activexcontrol advice ajax application asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child class click compatible confirmationcodegeneration content contenttype countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu edit feedback flash flv folder form forms google grid gridview homeedition hosting identity iframe iis index javascript jquery list maps menu mono mssql multistepregistration nameisnotdeclared object objects order problem profile ratings refer rotatepage save search security serializesmo.table session silverlight smartcard software sql suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt wizard xml





