oledb - access database, user level protection and vb.net -


    dim connectionstring string = "provider=microsoft.ace.oledb.12.0; data source=c:\users\itweb\documents\visual studio 2010\websites\notitiae\databases\notitiae.accdb"     dim dbconnection system.data.idbconnection = new system.data.oledb.oledbconnection(connectionstring)      dim querystring string = "select [tblcounties].* [tblcounties]"     dim dbcommand system.data.idbcommand = new system.data.oledb.oledbcommand     dbcommand.commandtext = querystring     dbcommand.connection = dbconnection      dim dataadapter system.data.idbdataadapter = new system.data.oledb.oledbdataadapter     dataadapter.selectcommand = dbcommand     dim dscounties system.data.dataset = new system.data.dataset     dataadapter.fill(dscounties) 

ok. i’m using above code connect access 2007 db. have add linked table pointing db has user level protection. research has shown me how add username , password connection string. dim connectionstring string = "provider=microsoft.ace.oledb.12.0; data source=c:\users\itweb\documents\visual studio 2010\websites\notitiae\databases\notitiae.accdb; user name=user; password=pwd;"

i learned need add reference workgroup file, “v:\database\workdir\diodb.mdw”. problem information online referencing workgroup files use adodb connection rather oledb connection , jet 4 rather ace 12. what’s syntax adding workgroup file? tried add adodb object visual studio project vs wouldn't add reference activex data objects 2.5. that's why i'm using oledb.

the following excel vba code works, proving ace.oledb can still open .mdb file user-level security. note attribute .mdw file still uses jet oledb: prefix.

sub ulstest() dim con adodb.connection, rst adodb.recordset set con = new adodb.connection con.open _         "provider=microsoft.ace.oledb.12.0;" & _         "data source=c:\users\public\ulstest\ulstest.mdb;" & _         "jet oledb:system database=c:\users\public\ulstest\security.mdw;" & _         "user id=gord;" & _         "password=obfuscated;" set rst = new adodb.recordset rst.open "select * ulstable", con debug.print rst(0).value rst.close set rst = nothing con.close set con = nothing end sub 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -