Solved

dbconn in global.asa

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

Suggested Solutions

Title # Comments Views Activity
FileUp - Classic ASP 5 24
Connection to multiple databases 13 37
Set time on Session (ASP) 14 31
SP converting date time to date and time separately 2 20
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 would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

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