944,083 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 26406
  • ASP RSS
Jun 28th, 2006
0

How i Can connect Sql Server with ASP

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

Sushil ..
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kapilver is offline Offline
5 posts
since Mar 2006
Jun 29th, 2006
0

Re: How i Can connect Sql Server with ASP

Hi Sushil,

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

ASP Syntax (Toggle Plain Text)
  1. <%
  2. dim cn, rs
  3. set cn=server.CreateObject("adodb.connection")
  4. cn.Open "Provider=sqloledb;SERVER=localhost;DATABASE=your_database_neme;UID=your_database_login_id;PWD=your_database_login_password;"
  5. set rs=server.CreateObject("adodb.recordset")
  6. rs.open "Select * from table_name",cn,adOpenKeyset,adLockOptimistic
  7. rs.addnew
  8. rs(0) = "here_is_your_value_for_first_field"
  9. rs(1) = "here_is_your_value_for_second_field"
  10. rs.update
  11. rs.close
  12. %>
Last edited by Ezzaral; Jun 11th, 2010 at 1:22 pm. Reason: Added code tags. Please use them to format any code that you post.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sandeep.kharat is offline Offline
3 posts
since Jun 2006
Aug 4th, 2009
0

Re: How i Can connect Sql Server with ASP

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?
Reputation Points: 120
Solved Threads: 134
Practically a Master Poster
Zero13 is offline Offline
620 posts
since Jan 2009
Aug 11th, 2009
0

Re: How i Can connect Sql Server with ASP

Hi Sushil,

connect ASP wtih SQL Server.
asp Syntax (Toggle Plain Text)
  1. <%
  2. dim con, Rs
  3. set con=server.CreateObject("adodb.connection")
  4. con.Open "Provider=sqloledb;SERVER=localhost;DATABASE=database_name;UID=login_ID ;PWD=login_password;"
  5. set Rs=server.CreateObject("adodb.recordset")
  6.  
  7. %>
Last edited by peter_budo; Aug 11th, 2009 at 2:28 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 12
Solved Threads: 0
Newbie Poster
Egypt web is offline Offline
19 posts
since Aug 2009
May 7th, 2010
0
Re: How i Can connect Sql Server with ASP
i donot know about how to set drivers. plz tell me the name of drivers of sql
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kiran gaba is offline Offline
1 posts
since May 2010
May 26th, 2010
0
Re: How i Can connect Sql Server with ASP
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)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mohamed_r is offline Offline
1 posts
since May 2010
May 31st, 2010
0
Re: How i Can connect Sql Server with ASP
please guys help me i want code to connect my asp code to the MSSQL SERVER
Please help me
Reputation Points: 10
Solved Threads: 0
Newbie Poster
maips is offline Offline
2 posts
since May 2010
Jun 11th, 2010
0
Re: How i Can connect Sql Server with ASP
Have you tried doing it through the designer hence creating the connection for you automatically
Reputation Points: 10
Solved Threads: 0
Newbie Poster
donnybrasco is offline Offline
2 posts
since Jun 2010
Jun 11th, 2010
0
Re: How i Can connect Sql Server with ASP
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.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: Is it possible to make process my form in two ways?
Next Thread in ASP Forum Timeline: Job site in ASP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC