Print Page | Close Window

Type mismatch: ’openDb’ ?!

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=3981
Printed Date: 30 March 2026 at 6:55am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Type mismatch: ’openDb’ ?!
Posted By: Lucent
Subject: Type mismatch: ’openDb’ ?!
Date Posted: 01 July 2003 at 1:14pm

Hi,

I have this asp dynamic mean script and trying to put it on my website. I got this error message, can anyone tell me how to fix it? thank you.

line 180 is

call openDb()

Does it look like I need to write something in the () ?

---------------

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'openDb'

line 180

-------------------------




Replies:
Posted By: aero
Date Posted: 01 July 2003 at 1:43pm

HI.

If U have made a site whit U'r DB connection in a inklude file U have to inklude the site om that site where U want to inklude the file !!

U'r inklude site can look like this:

<%

Dim objConn

Sub OpenDataBase(strDBPath)
 
  Dim strProvider

  strProvider = ""
  strProvider = strProvider & "Provider=Microsoft.Jet.OLEDB.4.0;"
 strProvider = strProvider & "Data Source=" & strDBPath & ";"
  strProvider = strProvider & "Persist Security Info=False"
  Set objConn = Server.CreateObject("ADODB.Connection")
  objConn.Open strProvider
 
End Sub

Sub CloseDataBase
 
  objConn.Close
  Set objConn = Nothing
End Sub

%>

Sub OpenDataBase(strDBPath)
is U'r connection whitout the place where U'r db is !!!

Sub CloseDataBase
is the funktion that close U'r connection/db !!!!

In U'r site where u have the inklude file U have a code that look like U'rs

Call OpenDataBase()

OPENDATABASE is like the SUB name in the connection site But U will get an error because U don't have write where U/the site can find the DB som changes the Call OpenDataBase() to:

Call OpenDataBase("d:\web\aspsoftware.dk\www\aero\aero.mdb")

Then the site will work and kan find the DB and remember the close funktion in u'r connection site Sub CloseDataBase !!!

Call CloseDataBase    U have to write this in u'r bottom of u'r site !!!

Hope U understand my english and that this will help U !!

 



Posted By: Lucent
Date Posted: 01 July 2003 at 4:34pm

since I use DSN string, is this what I should do?

Call OpenDataBase("DSN=mydb.mdb")

Do I have to do the same for closing too?

Call CloseDataBase("DSN=mydb.mdb")

thank you for your help!!   



Posted By: aero
Date Posted: 01 July 2003 at 4:37pm

no

Call OpenDataBase("U'r connection road")

Call CloseDataBase 

DSN shut be in the connection site !!!



Posted By: Lucent
Date Posted: 01 July 2003 at 5:06pm
wouldn't that be unsafe to my database? ppl could easily see it


Posted By: aero
Date Posted: 01 July 2003 at 5:45pm

No I use that script !!

Or I use the script like this:

MY connecting site:

<%
Dim connStr

Sub OpenDB

        connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="
        connStr = connStr & Server.MapPath("../nyhedscript/db/db.mdb")
          
End Sub

Sub CloseDB
 
  rs.Close
  Set rs = Nothing
End Sub

%>


My site that will show something from the DB

TOP:
<!--#include file="u'r connectsite.asp"-->

CONNECT:
Call OpenDB
Set rs = Server.CreateObject("ADODB.Recordset")

rs.Open "select [Name],[Age] from TEST " & _
  "ORDER BY [Id] DESC", connStr, 3, 4

U'R CODE and then:
Call CloseDB

IT works for me !!! 

 



Posted By: the boss
Date Posted: 01 July 2003 at 5:47pm
no one would see the path to ur databaase.. asp is pased on the server and the asp code is not accessible to the client


Posted By: aero
Date Posted: 22 July 2003 at 7:44pm

Hi. If U want 2 know more about:

- call openDb()
- Sub OpenDB

then I can recommend this good site and the site owner is also the code master 2 this EX. and have made the EX.

http://www.futte.dk/ - http://www.futte.dk/

klik on "Kode Eksempler" and the on "Database Connection til Access databaseer"  then U can se an EX.

BUT the site is in DANISH but have some good EX. !!!!!




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net