odbcConnection Class security exception. 
Author Message
 odbcConnection Class security exception.

I'm getting the following exception when creating the
odbcConnection class object.

An unhandled exception of
type 'System.Security.SecurityException' occurred in
Autoglobale Banking System.exe

Additional information: Security error.

Can you please help me figure out the reason for this
execption. The access database is define in the ODBC
administration. There is no retristion in terms of
security to the database

Sample of the code

Dim myConnString As String = "Driver={Microsoft Access
Driver
(*.mdb)};DBQ=c:\database\Autoglobale_Banking_System.mdb"

Dim mySelectQuery As String = "SELECT user_name FROM user
WHERE type <> 'admin'"

Dim myConnection As New OdbcConnection(myConnString)

The exception occurs in the OdbcConnection object.



Sat, 03 Dec 2005 03:25:15 GMT  
 odbcConnection Class security exception.
Why use ODBC for an MS Access Database?

Here is an alternate example using good 'old' ADO - you may want to look at
ADO.NET.

(I presume your using VB NET not VB6 - IF VB6 then ingore the 'Imports ADODB
and instead select a reference to Microsoft ActiveX Data Objects 2.6  - you
may need to download MDAC 2.6 from Microsoft if you don't have the reference
available or try to select a lower reference 2.1 for example ). All this
could be total rubbish as I don't know what language or version of MS Access
your using.
Imports ADODB

Dim myConnection As New ADODB.Recordset()

SQL = "SELECT user_name FROM user  WHERE type <> 'admin'"

myConnection = New ADODB.Recordset()
myConnection.CursorLocation = CursorLocationEnum.adUseServer
myConnection.Open(SQL, _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\database\Autoglobale_Banking_System.mdb;" & _
"user id=admin;password=;", _
CursorTypeEnum.adOpenKeyset, LockTypeEnum.adLockOptimistic)
do while not myConnection.EOF
 '**** retrieve records ****
 myConnection.movenext
loop

myConnection.close

Merlin


Quote:
> I'm getting the following exception when creating the
> odbcConnection class object.

> An unhandled exception of
> type 'System.Security.SecurityException' occurred in
> Autoglobale Banking System.exe

> Additional information: Security error.

> Can you please help me figure out the reason for this
> execption. The access database is define in the ODBC
> administration. There is no retristion in terms of
> security to the database

> Sample of the code

> Dim myConnString As String = "Driver={Microsoft Access
> Driver
> (*.mdb)};DBQ=c:\database\Autoglobale_Banking_System.mdb"

> Dim mySelectQuery As String = "SELECT user_name FROM user
> WHERE type <> 'admin'"

> Dim myConnection As New OdbcConnection(myConnString)

> The exception occurs in the OdbcConnection object.



Sat, 03 Dec 2005 04:47:24 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Security.Exception

2. Security exception

3. Deploying on XP with .Net Framework sp2 security exception unhandled

4. GetLogicalDrives and Security Exception

5. Security Exception on getImage

6. Seeking help to extend Exception class

7. Seeking help for Custom Exception Class

8. How can i get the hResult of the Exception class

9. best practice, exceptions in class constructor

10. Inheriting Exception Classes

11. Exception class

12. ODBCConnection doesn't evaluate cell references

 

 
Powered by phpBB® Forum Software