Hello when i run my application on server, the connection doesn’t open
–> my dataset is still closed
Dim strconnect As String = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + "rootPath" + "\" + "VSS_TESTDB.mdb" + "Persist Security Info=False"
Dim objConnection As New OleDbConnection(strconnect)
Dim sql As String = "SELECT VSS_Files.id, VSS_Files.filename,VSS_Files.dateOfCreation,VSSDirs.dir FROM VSS_Files , VSSDirs Where VSS_Files.dir_id = VSSDirs.id;"
Dim cmd As New OleDbCommand(sql, objConnection)
Dim myDataReader As OleDbDataReader
myDataReader = cmd.ExecuteReader()
what can i do?
greetings tyzak
You need to create an OleDbConnection using an OleDbConnectionStringBuilder to connect to the database.
For example:
EDIT: Your problem is probably that you put quotes around
rootPath. TheData Sourceof your connection string isDataSource=rootPath\VSS_TESTDB.mdb. I assume that you actually want it to have the value of therootPathvariable.Also, you need to open the connection.
Finally, you should close the connection and the DataReader using the
Usingstatement.See my updated example.