Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot connect to server

Status
Not open for further replies.

Mariootje

Programmer
Aug 10, 2001
33
NL
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(&quot;dbName&quot;)=&quot;dbRado&quot;
Session(Session(&quot;dbName&quot;) & &quot;_ConnectionString&quot;) = &quot;driver={Sql Server}; &quot; & _
&quot;Server=6594; Database=Northwind; &quot;
Session(Session(&quot;dbName&quot;) & &quot;_ConnectionTimeout&quot;) = 15
Session(Session(&quot;dbName&quot;) & &quot;_CommandTimeout&quot;) = 30
Session(Session(&quot;dbName&quot;) & &quot;_CursorLocation&quot;) = 3
Session(Session(&quot;dbName&quot;) & &quot;_RuntimeUserName&quot;) = &quot;sa&quot;
Session(Session(&quot;dbName&quot;) & &quot;_RuntimePassword&quot;) = &quot;jeroen&quot;
End Sub
</SCRIPT>

The asp-page which needs the connection with the database:

<%@ Language=VBScript %>
<% option explicit %>
<!--#include file =&quot;../aspinc/funcdb.inc&quot;-->
<%
Response.Buffer = True

On Error Resume Next

If fncOpenConn Then
Response.Write(&quot; try to open recordset&quot;)
If fncOpenSelect(oRs, fncSQL) Then
Response.Write(&quot; recordset is open&quot;)
If not oRs.Eof then
Response.Write(oRs)
else
Response.Write(&quot;no output&quot;)
end if
else
Response.Write(&quot;recordset error: &quot; & MessageNumber)
MessageNumber = 0
bOk = False
End if
Response.Write(&quot; close recordset and connection&quot;)
fncCloseSelect(oRs)
fncCloseConn
Else
MessageNumber = 0
bOk = False
Response.Write(&quot;connection error: &quot; & MessageNumber)'IT DISPLAYS: CONNECTION ERROR 0
End If

Response.Write(&quot; end if &quot;)'IT DISPLAYS: END IF

The fncOpenConn:
<%
Dim conDb
Dim cmdDb


Function fncOpenConn
On Error Resume Next

Set conDb = Server.CreateObject(&quot;ADODB.Connection&quot;)
conDb.ConnectionTimeout = Session(session(&quot;dbName&quot;) & &quot;_ConnectionTimeout&quot;)
conDb.CommandTimeout = Session(session(&quot;dbName&quot;) & &quot;_CommandTimeout&quot;)
conDb.Open Session(session(&quot;dbName&quot;) & &quot;_ConnectionString&quot;)
Set cmdDb = Server.CreateObject(&quot;ADODB.Command&quot;)

'* return result
If Err.Number <> 0 Then
fncOpenConn = False
Else
fncOpenConn = True
End If

Response.write(&quot; connection open? &quot; & fncOpenConn)IT DISPLAYS: CONNECTION OPEN? FALSE
End Function
%>

Hope anybody knows how to solve this problem, greetings,

Mariootje
 
This is to complicated... u could use a better way to do this...
Tell me... the sql server is on another computer? ________

George
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top