connect to password-protected access-file
-
vb.net URGENT! i am loading data from an access-database like this:
dim MyConnection As String = "Provider= Microsoft.Jet.OLEDB.4.0; Data Source=MyDatabase.mdb;" dim connStr As String = "SELECT * FROM table1" dim odc As OleDbConnection= New OleDbConnection(MyConnection ) dim oda As OleDbDataAdapter= New OleDbDataAdapter(connStr, odc) dim odb As OleDbCommandBuilder= New OleDbCommandBuilder(oda) dim dat As DataTable= New DataTable("MyDatatable") dim bmb As BindingManagerBase odc.Open() oda.Fill(dat) odc.Close() bmb = Me.BindingContext(dat) datagrid1.DataSource = dat
now i want to use a password-protected database. where do i have to insert the password in the example above? (i know that i shouldn't write the password into my code, but the file doesn't contain critical data. i just want to prevent, that user's messing up the file) and please, i need a solution for this example, not another way of connecting to the mdb-file, since i don't want to rewrite half of my project. thanks. -
vb.net URGENT! i am loading data from an access-database like this:
dim MyConnection As String = "Provider= Microsoft.Jet.OLEDB.4.0; Data Source=MyDatabase.mdb;" dim connStr As String = "SELECT * FROM table1" dim odc As OleDbConnection= New OleDbConnection(MyConnection ) dim oda As OleDbDataAdapter= New OleDbDataAdapter(connStr, odc) dim odb As OleDbCommandBuilder= New OleDbCommandBuilder(oda) dim dat As DataTable= New DataTable("MyDatatable") dim bmb As BindingManagerBase odc.Open() oda.Fill(dat) odc.Close() bmb = Me.BindingContext(dat) datagrid1.DataSource = dat
now i want to use a password-protected database. where do i have to insert the password in the example above? (i know that i shouldn't write the password into my code, but the file doesn't contain critical data. i just want to prevent, that user's messing up the file) and please, i need a solution for this example, not another way of connecting to the mdb-file, since i don't want to rewrite half of my project. thanks.Hello In your connection string: dim MyConnection As String = "Provider= Microsoft.Jet.OLEDB.4.0; Data Source=MyDatabase.mdb;persist Security Info=False;Jet OLEDB:Database Password=sysadm" Where sysadm is your password. Tip: Don´t use that password :-D Regards
-
Hello In your connection string: dim MyConnection As String = "Provider= Microsoft.Jet.OLEDB.4.0; Data Source=MyDatabase.mdb;persist Security Info=False;Jet OLEDB:Database Password=sysadm" Where sysadm is your password. Tip: Don´t use that password :-D Regards
thanks for the quick answer.