Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Connecting to Database using OLEDB


Message #1 by "John Kearns" <jdkearns@p...> on Thu, 20 Feb 2003 06:27:39
I can really use some help here.

I am trying to make a simple connection to an access database.
I create my connection object...
   dim conAccess as new System.Data.OleDb.OleDbConnection() 

When I set the creation string..
   conAccess.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Data 
Source = C:\Inetpub\wwwroot\aspdotnet\Johns_db.mdb;"

I get the following error 
    Compiler Error Message: BC30188: Expected either a variable, constant, 
Enum, Type, or procedural declaration.

Am I missing something?
Message #2 by "Paul Riley" <rilez@t...> on Thu, 20 Feb 2003 09:21:29 -0000
OK. Need to rush out really but heres some code that I know works

dim myconnection as oledbconnection
myconnection = new oledbconnection(<INSERT ALL YOUR STUFF IN HERE)
myconnection.open
Dim mycommand = new oledbcommand(<SQL QUERY>,myconnection)



-----Original Message-----
From: John Kearns [mailto:jdkearns@p...] 
Sent: 20 February 2003 06:28
To: aspx_beginners
Subject: [aspx_beginners] Connecting to Database using OLEDB


I can really use some help here.

I am trying to make a simple connection to an access database. I create
my connection object...
   dim conAccess as new System.Data.OleDb.OleDbConnection() 

When I set the creation string..
   conAccess.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Data

Source = C:\Inetpub\wwwroot\aspdotnet\Johns_db.mdb;"

I get the following error 
    Compiler Error Message: BC30188: Expected either a variable,
constant, 
Enum, Type, or procedural declaration.

Am I missing something?

Message #3 by "Ashish M.bhonkiya" <Ashishm@p...> on Thu, 20 Feb 2003 16:16:35 +0530
Use this connection string. i hope this shud work.


conAccess.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C://Inetpub//wwwroot//aspdotnet//Johns_db.mdb";
this string works fine in csharp i dont know if this is not working u please
try giving 

conAccess.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C://Inetpub//wwwroot//aspdotnet//Johns_db.mdb;"

Regards
Ashish Bhonkiya.

-----Original Message-----
From: John Kearns [mailto:jdkearns@p...]
Sent: Thursday, February 20, 2003 11:58 AM
To: aspx_beginners
Subject: [aspx_beginners] Connecting to Database using OLEDB


I can really use some help here.

I am trying to make a simple connection to an access database.
I create my connection object...
   dim conAccess as new System.Data.OleDb.OleDbConnection() 

When I set the creation string..
   conAccess.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Data 
Source = C:\Inetpub\wwwroot\aspdotnet\Johns_db.mdb;"

I get the following error 
    Compiler Error Message: BC30188: Expected either a variable, constant, 
Enum, Type, or procedural declaration.

Am I missing something?

Message #4 by "John Kearns" <jdkearns@p...> on Thu, 20 Feb 2003 10:45:58 -0500
Thank you very much for your help

But, im still getting the same error, (Expected either a variable, constant,
Enum, Type, or procedural declaration)
when I try this line

myconnection = new oledbconnection("Provider = Microsoft.Jet.OLEDB.4.0;Data
Source = C:\Inetpub\wwwroot\aspdotnet\Johns_db.mdb;")

I dont think its the syntax, It seems like the datatype is not being
recognized.
Could I be missing the correct ODBC driver, is there something I need to
install or include in my aspx page?   This is driving me crazy!!

Thanks,
John Kearns





----- Original Message -----
From: "Paul Riley" <rilez@t...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Thursday, February 20, 2003 4:21 AM
Subject: [aspx_beginners] RE: Connecting to Database using OLEDB


> OK. Need to rush out really but heres some code that I know works
>
> dim myconnection as oledbconnection
> myconnection = new oledbconnection(<INSERT ALL YOUR STUFF IN HERE)
> myconnection.open
> Dim mycommand = new oledbcommand(<SQL QUERY>,myconnection)
>
>
>
> -----Original Message-----
> From: John Kearns [mailto:jdkearns@p...]
> Sent: 20 February 2003 06:28
> To: aspx_beginners
> Subject: [aspx_beginners] Connecting to Database using OLEDB
>
>
> I can really use some help here.
>
> I am trying to make a simple connection to an access database. I create
> my connection object...
>    dim conAccess as new System.Data.OleDb.OleDbConnection()
>
> When I set the creation string..
>    conAccess.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Data
>
> Source = C:\Inetpub\wwwroot\aspdotnet\Johns_db.mdb;"
>
> I get the following error
>     Compiler Error Message: BC30188: Expected either a variable,
> constant,
> Enum, Type, or procedural declaration.
>
> Am I missing something?
>
>
>

Message #5 by "Paul Riley" <rilez@t...> on Thu, 20 Feb 2003 16:24:05 -0000
If you can open the db yourself then you have the odbc driver installed
almost definitely. 
provider=microsoft.jet.OLEDB.4.0;data
source=C:\Inetpub\wwwroot\aspdotnet\Johns_db.mdb should work fine. Does
the asp.net account have access to the database? It is at that path
isn't it? Aspdotnet isn't a virtual directory or anything? Try entering
that path into the run command and see what happens to make sure the
path is correct. Finally have you tried defining a DSN (using the ODBC
part of control panel (might be under admin tools)) and accessing that
directly "dsn=moo" iirc assuming u name the dsn moo ... Do you
understand me?

If none of this works please paste all of your code. I want to double
check it :)

All the best
Paul

-----Original Message-----
From: John Kearns [mailto:jdkearns@p...] 
Sent: 20 February 2003 15:46
To: aspx_beginners
Subject: [aspx_beginners] RE: Connecting to Database using OLEDB


Thank you very much for your help

But, im still getting the same error, (Expected either a variable,
constant, Enum, Type, or procedural declaration) when I try this line

myconnection = new oledbconnection("Provider 
Microsoft.Jet.OLEDB.4.0;Data Source 
C:\Inetpub\wwwroot\aspdotnet\Johns_db.mdb;")

I dont think its the syntax, It seems like the datatype is not being
recognized. Could I be missing the correct ODBC driver, is there
something I need to
install or include in my aspx page?   This is driving me crazy!!

Thanks,
John Kearns





----- Original Message -----
From: "Paul Riley" <rilez@t...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Thursday, February 20, 2003 4:21 AM
Subject: [aspx_beginners] RE: Connecting to Database using OLEDB


> OK. Need to rush out really but heres some code that I know works
>
> dim myconnection as oledbconnection
> myconnection = new oledbconnection(<INSERT ALL YOUR STUFF IN HERE) 
> myconnection.open Dim mycommand = new oledbcommand(<SQL 
> QUERY>,myconnection)
>
>
>
> -----Original Message-----
> From: John Kearns [mailto:jdkearns@p...]
> Sent: 20 February 2003 06:28
> To: aspx_beginners
> Subject: [aspx_beginners] Connecting to Database using OLEDB
>
>
> I can really use some help here.
>
> I am trying to make a simple connection to an access database. I 
> create my connection object...
>    dim conAccess as new System.Data.OleDb.OleDbConnection()
>
> When I set the creation string..
>    conAccess.ConnectionString = "Provider = 
> Microsoft.Jet.OLEDB.4.0;Data
>
> Source = C:\Inetpub\wwwroot\aspdotnet\Johns_db.mdb;"
>
> I get the following error
>     Compiler Error Message: BC30188: Expected either a variable, 
> constant, Enum, Type, or procedural declaration.
>
> Am I missing something?
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to 
> unsubscribe send a blank email to 
>
>
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to 
> unsubscribe send a blank email to
>




  Return to Index