Signup · Login
Stardeveloper.com  
Home · Tutorials · Forums · Web Hosting Plans · Faisal Khan's Blog · Contact
Forums : ASP : ADO/ODBC : ODBC Connection for SQL Signup · Login
Author Thread
ODBC Connection for SQL
Posted in tutorial: Accessing database from an ASP page
·  tansarbh
User
Joined: 1 Jun 2004
Total Posts: 1
ODBC Connection for SQL
Posted: 1 Jun 2004
Hi,

I have a table in a SQL database on network. I have created connection and the name of the datasource cnibmagic.

I am building a page in FrontPage.

Can you please tell me detailed process to display my records from thaty page in a table in multipage format?

Thank you in advance.


Mustansar

TB
·  DevDevil
UserUser
Joined: 3 Jun 2004
Total Posts: 13
ODBC Connection for SQL
Posted: 4 Jun 2004
Here's a very compact example:
<%@ LANGUAGE = VBScript %>
<% Option Explicit

' Declare your Variables
Dim DBConn, rstOne, strSQL1
' Create your Connection
Set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open "Provider=SQLOLEDB; Data Source=YourDataSource;" & _
"Initial Catalog=DatabaseName;UId=#####;pwd=#####;"
' Create your Recordset Object
Set rstOne = Server.CreateObject("ADODB.Recordset")
Set rstOne = DBConn.Execute("SELECT FirstName FROM DatabaseName")
' Write your Data to yourpage.asp
Response.Write rstOne("FirstName")

%>

I don't think I left anything out, but like I said this is a very compact example. You can build upon this once you analyze it and see what's happening where.

Users Who Have Visited This Thread In Last 24 Hours
3 Visitors

Login
UserName Or Email Address:       Password:       Auto-Login:    
· Create New User Account
· Send Forgotten Password by Email
 
© 1999 - 2009 Stardeveloper.com, All Rights Reserved.