I am creating my first web-site in asp.net....I want to use sql as a database. How can I connect with the database. How can I use it??
ASP.NET SQL databaseI am creating my first web-site in asp.net....I want to use sql as a
Page 1 of 1
2 Replies - 1554 Views - Last Post: 12 June 2008 - 11:03 AM
Replies To: ASP.NET SQL database
#2
Re: ASP.NET SQL database
Posted 11 June 2008 - 11:38 PM
Jaldeep.lancer, on 11 Jun, 2008 - 10:54 PM, said:
I am creating my first web-site in asp.net....I want to use sql as a database. How can I connect with the database. How can I use it??
Hi,
pls ses the code
------------------------------------------------------------------
String StrConnect = ConfigurationManager.ConnectionStrings["NameRecordConnectionString"].ConnectionString;
//"Data Source=VTECHSOF;Initial Catalog=NameRecord;Integrated Security=SSPI";
SqlConnection connection = new SqlConnection(StrConnect);
//string Sql = "Insert into EmpMaster(EmpId,EmpName,FileName) Values(" + txtEmpId.Text + ",'" + txtName.Text + "','" + FileName + "')";
SqlCommand cmd = new SqlCommand();
cmd.Connection = connection;
cmd.CommandText = "InsertOfficerRecord5";
cmd.CommandType = CommandType.StoredProcedure;
try
//write code here
cmd.parameters.add(@add,Sqldbtype.varchar);
cmd.parameters.add["@add].value=txtEmpid.text;
Catch(Exception ex)
{
connection.close();
}
This post has been edited by kamlesh: 11 June 2008 - 11:39 PM
#3
Re: ASP.NET SQL database
Posted 12 June 2008 - 11:03 AM
Since you didn't specify which language you are using for the code-behind, I am giving you a link to a tutorial on using Sql Server with VB.NET.
SQL Basics In VB.Net
SQL Basics In VB.Net
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|