database connection 
Author Message
 database connection

Hi all,
I have tried to connect a database using ODBC drivers and had good fortune
with it.
I just found out that my ISP runs ASP but doesn't allow System DSN's.
They tell me that i have to set up the Database so the connection opens and
closes within the web site itself.
Does anyone have any info or Documentation they can point me to so i can
learn about this.
Examples would be greatly appreciated and on what pages i apply code to, if
any.

Thank you.
Gianna.



Tue, 25 Feb 2003 18:45:01 GMT  
 database connection

Hi Gianna,

SQL Server: ( In the connection string, change the Password, User ID,
Initial Catalog(database name), and Source(SQL Server IP address)
accordingly)

      Active Server Page Code Example

--- BEGIN CODE COPY HERE ---->

<%
' Dim the Recordset Object
Dim rsADO

' Define the Connection String From Above
ConnectionString = "Provider=SQLOLEDB.1; Network
Library=dbmssocn;Password=yourpassword;User ID=yourid;Initial
Catalog=mydatabase;Data Source=000.000.000.000;"

' Create the Object
Set rsADO = Server.CreateObject("ADODB.Recordset")

' Define the SQL Statement
' (REPLACE TABLENAME WITH THE TABLE NAME
' IN YOUR DATABASE)
Source = "SELECT * FROM TABLENAME"

' Open the Recordset
rsADO.Open Source, ConnectionString

' Display the Fields Returned
' (PUT YOUR FIELD NAMES WHERE FieldName1 and
' FieldName2 Appear)
if not rsADO.EOF then
        Response.Write rsADO("FieldName1")
        Response.Write rsADO("FieldName2")
        ... etc ...
end if

' DeAllocate the Object to Free Server Memory
set rsADO = nothing
%>
<--- END CODE COPY HERE ----

MS Access: (In the connectionstring, change the data source(database file
path and name), and if applicable, User ID and password)

      Active Server Page Code Example

--- BEGIN CODE COPY HERE ---->

<%
' Dim the Recordset Object
Dim rsADO

' Define the Connection String From Above
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Network
Library=dbmssocn; Data Source=D:\\mydatabase.mdb;User ID=;Password=;"

' Create the Object
Set rsADO = Server.CreateObject("ADODB.Recordset")

' Define the SQL Statement
' (REPLACE TABLENAME WITH THE TABLE NAME
' IN YOUR DATABASE)
Source = "SELECT * FROM TABLENAME"

' Open the Recordset
rsADO.Open Source, ConnectionString

' Display the Fields Returned
' (PUT YOUR FIELD NAMES WHERE FieldName1 and
' FieldName2 Appear)
if not rsADO.EOF then
        Response.Write rsADO("FieldName1")
        Response.Write rsADO("FieldName2")
        ... etc ...
end if

' DeAllocate the Object to Free Server Memory
set rsADO = nothing
%>
<--- END CODE COPY HERE ----

Regards,
Dan


Quote:
> Hi all,
> I have tried to connect a database using ODBC drivers and had good fortune
> with it.
> I just found out that my ISP runs ASP but doesn't allow System DSN's.
> They tell me that i have to set up the Database so the connection opens
and
> closes within the web site itself.
> Does anyone have any info or Documentation they can point me to so i can
> learn about this.
> Examples would be greatly appreciated and on what pages i apply code to,
if
> any.

> Thank you.
> Gianna.




Wed, 26 Feb 2003 02:09:38 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Multi User Connection via COM for database connection

2. Refreshing database connection

3. DAO database connection to SQL Server

4. DAO Database Connection

5. Access bloats when closing external database connection

6. DATABASE CONNECTION

7. DSNless Database Connection

8. Outlook2000 & MS database connection

9. PROGRESS Database Connections

10. database connection

11. database connections

12. Database connection problem

 

 
Powered by phpBB® Forum Software