S
Simon Harris
Hi All,
I have pieced together this from a couple of samples:
<%@ Control Language="vb" %>
<Script runat="Server">
Public Function GetConnection()
Import System.Data.OleDb
Dim Conn as OleDbConnection
Dim ConnStr as String
ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and
Settings\Simon\My
Documents\Adotek\Projects\SkiPassDirect\private\skipassdirect_mainDB.mdb"
'For password protected DB's add "Userid=xxxx;Password=xxxxx" to the above
string
Conn=new OleDbConnection(ConnStr)
end Function
</Script>
This is in "database_connection.ascx"
I am registering the class like this:
<%@ Register TagPrefix="SPD" TagName="DBConnection"
src="/assets/classes/database_connection.ascx"%>
And opening the connection like this:
<SPD
BConnection id="DBConnection" runat="Server"/>
I get the following error:
Compiler Error Message: BC30451: Name 'Import' is not declared.
Source Error:
Line 2: <Script runat="Server">
Line 3: Public Function GetConnection()
Line 4: Import System.Data.OleDb
Line 5: Dim Conn as OleDbConnection
Line 6: Dim ConnStr as String
Can anyone advise where I've gone wrong?
Thanks!!
Simon.
--
-
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co.uk/groups
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
I have pieced together this from a couple of samples:
<%@ Control Language="vb" %>
<Script runat="Server">
Public Function GetConnection()
Import System.Data.OleDb
Dim Conn as OleDbConnection
Dim ConnStr as String
ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and
Settings\Simon\My
Documents\Adotek\Projects\SkiPassDirect\private\skipassdirect_mainDB.mdb"
'For password protected DB's add "Userid=xxxx;Password=xxxxx" to the above
string
Conn=new OleDbConnection(ConnStr)
end Function
</Script>
This is in "database_connection.ascx"
I am registering the class like this:
<%@ Register TagPrefix="SPD" TagName="DBConnection"
src="/assets/classes/database_connection.ascx"%>
And opening the connection like this:
<SPD

I get the following error:
Compiler Error Message: BC30451: Name 'Import' is not declared.
Source Error:
Line 2: <Script runat="Server">
Line 3: Public Function GetConnection()
Line 4: Import System.Data.OleDb
Line 5: Dim Conn as OleDbConnection
Line 6: Dim ConnStr as String
Can anyone advise where I've gone wrong?
Thanks!!
Simon.
--
-
* Please reply to group for the benefit of all
* Found the answer to your own question? Post it!
* Get a useful reply to one of your posts?...post an answer to another one
* Search first, post later : http://www.google.co.uk/groups
* Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!