Search code examples
vb.netinstallationreleasepublish

Running published project in other computer


I have done developing and tried debugger and the code run fine in my laptop, but when Publishing or even using Release mode and than using it in other computers it show null exception

in this part of code

     For Each r As DataRow In Access.dbDataTable.Rows
        Check = r("EmployeeType")
    Next

this one used in login Form and yes I forget to mention I use Access DB I am really confused it's work fine than why it show exception

by the way my connection string

Dim mypath = Application.StartupPath & "\test.accdb"
Dim mypassword = "test"
Private dbConnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & mypath & ";Jet OLEDB:Database Password=" & mypassword)

exception shown is NullRefrenceException


Solution

  • I have solved the problem if anyone got same problem try to check the version of ms access it should have same version also check connection string

    Private dbConnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & mypath & ";Jet OLEDB:Database Password=" & mypassword)
    

    Microsoft.ACE.OLEDB.12.0 Need to be changed to same version of ms access targeted PC