?
Solved

dbconn in global.asa

Posted on 2001-07-18
3
Medium Priority
?
578 Views
Last Modified: 2008-02-01
hi,
i am getting a type mismatch trying to
<%
Call OpenDB()
%>

here is the function, what am i missing ??

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">


Dim rs, dbConn

Function OpenDB()
     Set dbConn = Server.CreateObject("ADODB.Connection")
     dbConn.ConnectionTimeout = 15
     dbConn.CommandTimeout = 30
     dbConn.Open Application("dbConn_ConnectionString")    

End Function

Function CloseDB()
     ' close cursor and database connection
     Set rs = Nothing
     if ucase(TypeName(dbConn)) = "OBJECT" then
          dbConn.Close
          Set dbConn = Nothing
     end if
End Function


</SCRIPT>
0
Comment
Question by:neostudio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6295963
My guess is this line

dbConn.Open Application("dbConn_ConnectionString")    

What is this  <<Application("dbConn_ConnectionString")>>
0
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6295967
Oh, I get it! you are trying to connect in your global.asa without exposing your connect string.  I've read some serious no no's about doing that!  I think you are just now finding some of the problems with it...
0
 
LVL 5

Accepted Solution

by:
dgorin earned 100 total points
ID: 6296415
The function appears correct.  Looks like it's using an Interdev created connection?

Change the function to a sub.  Your 'call openDB()' isn't correct.  A function returns a value and you're not putting it anywhere.  Try

<%
Call OpenDB%>

here is the function, what am i missing ??

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">


Dim rs, dbConn

Sub OpenDB()
    Set dbConn = Server.CreateObject("ADODB.Connection")
    dbConn.ConnectionTimeout = 15
    dbConn.CommandTimeout = 30
    dbConn.Open Application("dbConn_ConnectionString")    

End Sub

Sub CloseDB()
    ' close cursor and database connection
    Set rs = Nothing
    if ucase(TypeName(dbConn)) = "OBJECT" then
         dbConn.Close
         Set dbConn = Nothing
    end if
End Sub


</SCRIPT>
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question