Hello,
I've been working on this some for some time now, but I am still not able to get a connection to my server. My script is build up with the usual global.asa, then the asp page to open and a file with the function(s) needed.
My global.asa looks as follows:
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Session_OnStart
'==Visual InterDev Generated - startspan==
'--Project Data Connection RadolexI
Session("dbName"="dbRado"
Session(Session("dbName" & "_ConnectionString" = "driver={Sql Server}; " & _
"Server=6594; Database=Northwind; "
Session(Session("dbName" & "_ConnectionTimeout" = 15
Session(Session("dbName" & "_CommandTimeout" = 30
Session(Session("dbName" & "_CursorLocation" = 3
Session(Session("dbName" & "_RuntimeUserName" = "sa"
Session(Session("dbName" & "_RuntimePassword" = "jeroen"
End Sub
</SCRIPT>
The asp-page which needs the connection with the database:
<%@ Language=VBScript %>
<% option explicit %>
<!--#include file ="../aspinc/funcdb.inc"-->
<%
Response.Buffer = True
On Error Resume Next
If fncOpenConn Then
Response.Write(" try to open recordset"
If fncOpenSelect(oRs, fncSQL) Then
Response.Write(" recordset is open"
If not oRs.Eof then
Response.Write(oRs)
else
Response.Write("no output"
end if
else
Response.Write("recordset error: " & MessageNumber)
MessageNumber = 0
bOk = False
End if
Response.Write(" close recordset and connection"
fncCloseSelect(oRs)
fncCloseConn
Else
MessageNumber = 0
bOk = False
Response.Write("connection error: " & MessageNumber)'IT DISPLAYS: CONNECTION ERROR 0
End If
Response.Write(" end if "'IT DISPLAYS: END IF
The fncOpenConn:
<%
Dim conDb
Dim cmdDb
Function fncOpenConn
On Error Resume Next
Set conDb = Server.CreateObject("ADODB.Connection"
conDb.ConnectionTimeout = Session(session("dbName" & "_ConnectionTimeout"
conDb.CommandTimeout = Session(session("dbName" & "_CommandTimeout"
conDb.Open Session(session("dbName" & "_ConnectionString"
Set cmdDb = Server.CreateObject("ADODB.Command"
'* return result
If Err.Number <> 0 Then
fncOpenConn = False
Else
fncOpenConn = True
End If
Response.write(" connection open? " & fncOpenConn)IT DISPLAYS: CONNECTION OPEN? FALSE
End Function
%>
Hope anybody knows how to solve this problem, greetings,
Mariootje
I've been working on this some for some time now, but I am still not able to get a connection to my server. My script is build up with the usual global.asa, then the asp page to open and a file with the function(s) needed.
My global.asa looks as follows:
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Session_OnStart
'==Visual InterDev Generated - startspan==
'--Project Data Connection RadolexI
Session("dbName"="dbRado"
Session(Session("dbName" & "_ConnectionString" = "driver={Sql Server}; " & _
"Server=6594; Database=Northwind; "
Session(Session("dbName" & "_ConnectionTimeout" = 15
Session(Session("dbName" & "_CommandTimeout" = 30
Session(Session("dbName" & "_CursorLocation" = 3
Session(Session("dbName" & "_RuntimeUserName" = "sa"
Session(Session("dbName" & "_RuntimePassword" = "jeroen"
End Sub
</SCRIPT>
The asp-page which needs the connection with the database:
<%@ Language=VBScript %>
<% option explicit %>
<!--#include file ="../aspinc/funcdb.inc"-->
<%
Response.Buffer = True
On Error Resume Next
If fncOpenConn Then
Response.Write(" try to open recordset"
If fncOpenSelect(oRs, fncSQL) Then
Response.Write(" recordset is open"
If not oRs.Eof then
Response.Write(oRs)
else
Response.Write("no output"
end if
else
Response.Write("recordset error: " & MessageNumber)
MessageNumber = 0
bOk = False
End if
Response.Write(" close recordset and connection"
fncCloseSelect(oRs)
fncCloseConn
Else
MessageNumber = 0
bOk = False
Response.Write("connection error: " & MessageNumber)'IT DISPLAYS: CONNECTION ERROR 0
End If
Response.Write(" end if "'IT DISPLAYS: END IF
The fncOpenConn:
<%
Dim conDb
Dim cmdDb
Function fncOpenConn
On Error Resume Next
Set conDb = Server.CreateObject("ADODB.Connection"
conDb.ConnectionTimeout = Session(session("dbName" & "_ConnectionTimeout"
conDb.CommandTimeout = Session(session("dbName" & "_CommandTimeout"
conDb.Open Session(session("dbName" & "_ConnectionString"
Set cmdDb = Server.CreateObject("ADODB.Command"
'* return result
If Err.Number <> 0 Then
fncOpenConn = False
Else
fncOpenConn = True
End If
Response.write(" connection open? " & fncOpenConn)IT DISPLAYS: CONNECTION OPEN? FALSE
End Function
%>
Hope anybody knows how to solve this problem, greetings,
Mariootje