Solved

dbconn in global.asa

Posted on 2001-07-18
3
567 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 25 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

726 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