QUOTE(Jaldeep.lancer @ 11 Jun, 2008 - 10:54 PM)

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 Jun, 2008 - 10:39 PM