help me out.. packaging related..

the.kaushik

Member
Joined
Mar 4, 2007
Messages
16
Programming Experience
Beginner
i have made a DB programming using this tutorial...

http://www.homeandlearn.co.uk/NET/nets12p5.html

i have kept my mdb file in c:/XXXX.mdb

i am successful to do the whole tutorial.. but problem is how to publish it..
in a successful publishing its not including my mdb file and when i wants to execute the same in friends pc it says c:/XXXX.mdb file not found which means it hasent packaged while publishing

what should i do.. any idea.. am a beginner!
 
Last edited:
Couldnt you put the mdb into the applications folder and then include it in the package when you public it. tell your program to look at applicationpath/XXXX.mdb
 
Couldnt you put the mdb into the applications folder and then include it in the package when you public it. tell your program to look at applicationpath/XXXX.mdb

i did.. i gave the path as
/mysoft_name/my_mdb_file

wher my mdb file exists in e:/mysoft_name/my_mdb_file

but when i am running it its working but as i am publishing it it giving erroe as

c:/mysoft_name/my_mdb_file not found..! what to do???
 
VB.NET:
Dim dbLoc As String = My.Application.Info.DirectoryPath & "\data.mdb"

That should then work for whereever the app is installed.
 
VB.NET:
Dim dbLoc As String = My.Application.Info.DirectoryPath & "\data.mdb"
That should then work for whereever the app is installed.

no friend not working.. have u tried?

heres what i did

VB.NET:
Dim dbLoc As String = My.Application.Info.DirectoryPath & "\AddressBook.mdb"
MsgBox(dbLoc.ToString)
        con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source =" + dbLoc
and my database file is at the place where the msgbox is pointing :)
 
Thats what I did in my app that uses access. Worked perfectly for me. Heres my openconnection sub

VB.NET:
Private dbLoc As String = My.Application.Info.DirectoryPath & "\data.mdb"
        Private Sub OpenConnection()
            Dim strConnectionString As String
            'make the connection string
            strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbLoc & ";Persist Security Info=False"
            'new connection object using the connection string
            m_Connection = New OleDbConnection(strConnectionString)
            'open the connection
            m_Connection.Open()
        End Sub
 
any body ther?

You should have said "Yes" to the question that popped up saying "do you want to copy this MDB to the local project.

As it is now, you must copy it in yourself, include it yourself, and alter the connection string in the settings to use a relative,not an absolute path
 
Oh, and if your Settings doesnt contain a conenction string, then you followed a bum tutorial, sorry.. Try reading the DW2 link in my signature, section (from the list on the left) called Creating a Simple Application..
 
Back
Top