We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,745 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How i Can connect Sql Server with ASP

Hi friend, i am trying to learn ASP but i face problem to connect ASP wtih
SQL Server.
Anyone help me.

Sushil ..

13
Contributors
9
Replies
6 Years
Discussion Span
9 Months Ago
Last Updated
20
Views
kapilver
Newbie Poster
5 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Hi Sushil,

use this code to add data in a table using asp and sql server

<%
dim cn, rs
set cn=server.CreateObject("adodb.connection")
cn.Open "Provider=sqloledb;SERVER=localhost;DATABASE=your_database_neme;UID=your_database_login_id;PWD=your_database_login_password;"
set rs=server.CreateObject("adodb.recordset")
rs.open "Select * from table_name",cn,adOpenKeyset,adLockOptimistic
rs.addnew
rs(0) = "here_is_your_value_for_first_field"
rs(1) = "here_is_your_value_for_second_field"
rs.update
rs.close
%>
sandeep.kharat
Newbie Poster
3 posts since Jun 2006
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Connect to SQL server with ASP needs ADODB connection.
This connection can extract data from database and insert data into database.
What problem do you face?

ko ko
Practically a Master Poster
673 posts since Jan 2009
Reputation Points: 120
Solved Threads: 152
Skill Endorsements: 1

Hi Sushil,

connect ASP wtih SQL Server.

<%
dim con, Rs
set con=server.CreateObject("adodb.connection")
con.Open "Provider=sqloledb;SERVER=localhost;DATABASE=database_name;UID=login_ID ;PWD=login_password;"
set Rs=server.CreateObject("adodb.recordset")

%>
Egypt web
Newbie Poster
19 posts since Aug 2009
Reputation Points: 12
Solved Threads: 0
Skill Endorsements: 0

i donot know about how to set drivers. plz tell me the name of drivers of sql

kiran gaba
Newbie Poster
1 post since May 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

well i tried the above code to connect the SQL table, but it is always giving me an error and the webpage can not be displayed... any help please.. (btw i'm using SQL server 2008)

mohamed_r
Newbie Poster
1 post since May 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

please guys help me i want code to connect my asp code to the MSSQL SERVER
Please help me

maips
Newbie Poster
2 posts since May 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Have you tried doing it through the designer hence creating the connection for you automatically

donnybrasco
Newbie Poster
2 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

It's doubtful. They evidently cannot even follow the most basic of instructions, search on their own for information that is available all over the net, or post detailed information about the problems they are experiencing.

Ezzaral
null
Moderator
16,110 posts since May 2007
Reputation Points: 3,292
Solved Threads: 873
Skill Endorsements: 27

hello

johnjaafarj
Newbie Poster
1 post since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0825 seconds using 2.7MB