How i Can connect Sql Server with ASP

Reply

Join Date: Mar 2006
Posts: 5
Reputation: kapilver is an unknown quantity at this point 
Solved Threads: 0
kapilver kapilver is offline Offline
Newbie Poster

How i Can connect Sql Server with ASP

 
0
  #1
Jun 28th, 2006
Hi friend, i am trying to learn ASP but i face problem to connect ASP wtih
SQL Server.
Anyone help me.

Sushil ..
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 3
Reputation: sandeep.kharat is an unknown quantity at this point 
Solved Threads: 0
sandeep.kharat's Avatar
sandeep.kharat sandeep.kharat is offline Offline
Newbie Poster

Re: How i Can connect Sql Server with ASP

 
0
  #2
Jun 29th, 2006
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
%>
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 102
Reputation: Zero13 is an unknown quantity at this point 
Solved Threads: 16
Zero13 Zero13 is offline Offline
Junior Poster

Re: How i Can connect Sql Server with ASP

 
0
  #3
Aug 4th, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 15
Reputation: Egypt web is an unknown quantity at this point 
Solved Threads: 0
Egypt web's Avatar
Egypt web Egypt web is offline Offline
Newbie Poster

Re: How i Can connect Sql Server with ASP

 
0
  #4
Aug 11th, 2009
Hi Sushil,

connect ASP wtih SQL Server.
  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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 12083 | Replies: 3
Thread Tools Search this Thread



Tag cloud for ASP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC