Welcome to Dream.In.Code
Become an Expert!

Join 150,068 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,799 people online right now. Registration is fast and FREE... Join Now!




ASP.NET SQL database

 
Reply to this topicStart new topic

ASP.NET SQL database, I am creating my first web-site in asp.net....I want to use sql as a

Jaldeep.lancer
11 Jun, 2008 - 09:54 PM
Post #1

New D.I.C Head
*

Joined: 11 Jun, 2008
Posts: 1

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??
User is offlineProfile CardPM
+Quote Post

kamlesh
RE: ASP.NET SQL Database
11 Jun, 2008 - 10:38 PM
Post #2

New D.I.C Head
*

Joined: 8 Apr, 2008
Posts: 12

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
User is offlineProfile CardPM
+Quote Post

Jayman
RE: ASP.NET SQL Database
12 Jun, 2008 - 10:03 AM
Post #3

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,319



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
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
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 10:53PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month