Current location: Hot Scripts Forums » Programming Languages » ASP » connecting to SQL server 2000


connecting to SQL server 2000

Reply
  #1 (permalink)  
Old 01-12-04, 02:28 PM
wajeeh_r wajeeh_r is offline
Newbie Coder
 
Join Date: Jan 2004
Location: Karachi, Pakistan
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
connecting to SQL server 2000

hello all!

i want a simple exapmle to establish connectivity between asp page and SQL server 2000. i've databse with name SECTS in SQL server and there is a table in it members now please tell me what code should be written in asp page to establish connection and then selecting all records from member table.

please give me code.

waiting for replys
bye
Reply With Quote
  #2 (permalink)  
Old 01-12-04, 06:34 PM
jayhawk jayhawk is offline
Newbie Coder
 
Join Date: Dec 2003
Location: Santa Fe, NM
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
There are a couple of ways to connect. Here is one example:

<%
set cn_connection = Server.CreateObject("ADODB.Connection")
cn_connection.ConnectionTimeout = 120
cn_connection.Mode = 3
cn_connection.open "Driver={SQL Server};" & _
"Server=Server IP or Hostname;" & _
"Database=SECTS;" & _
"Trusted_Connection=yes"
%>

As far as selecting all records, the below example will work:

sql = "SELECT * FROM members"
Set rs_getType = cn_Connection.Execute(sql)

while not rs_getEvent.EOF
variable = rs_getEvent("fldname")
variable2 = rs_getEvent("fldname2")
rs_getEvent.movenext
wend
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free web site, control panel, and dedicated IP with game server purchase for only $25 twastudios General Advertisements 3 10-20-05 06:13 AM
Inset stmt in MS SQl Server 2000 andreasberglind Database 1 08-16-03 04:49 PM
change my field in this example sal21 ASP 3 07-14-03 02:49 AM
Web Interface for SQL Server 2000 Greg Database 2 06-16-03 09:00 AM
Windows 2000 Hosting with ASP.NET & MS SQL - $6.99/mo JodoHost General Advertisements 0 06-15-03 10:08 AM


All times are GMT -5. The time now is 04:05 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.