ASP.NET SQL database

I am creating my first web-site in asp.net....I want to use sql as a

Page 1 of 1

2 Replies - 1944 Views - Last Post: 12 June 2008 - 11:03 AM Rate Topic: -----

#1 Jaldeep.lancer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-June 08

ASP.NET SQL database

Post icon  Posted 11 June 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??
Is This A Good Question/Topic? 0
  • +

Replies To: ASP.NET SQL database

#2 kamlesh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 08-April 08

Re: ASP.NET SQL database

Posted 11 June 2008 - 11:38 PM

View PostJaldeep.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

Was This Post Helpful? 0
  • +
  • -

#3 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

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
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1