5 Replies - 432 Views - Last Post: 30 November 2011 - 10:53 PM Rate Topic: -----

#1 prasad.weer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 10-November 11

Problem in Setup file

Posted 17 November 2011 - 02:53 AM

I've developed a software using VB.Net and SQL compact edition database. (.sdf file)
Now i want to add my .sdf file to setup file. I've search internet and create setup file.
when i install the software, it is created new folders in program files including my database file and exe file.
after double clicking exe file, it is open the software. but when using, it's shown a message "connection current state is closed". but when i run my vb project, it is working well.

other details.
=============

1) I create data base inside of <myProject>/bin/debug
2) I've created setup file using this method.
File menu --> add --> new project
Then, Setup and deployment -> Visual studio installer
After that I selected Setup project, then click OK.
3) I add database using this
Right click on setup file -> add -> file (In solution explorer window)
Then i selected my .sdf file.

this is my connection string


sqlcon = New SqlCeConnection("Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)) + "\stuDB.sdf")



It is created only 3 files in Program files.
1. my exe
2. my sdf file
3. System.Data.SqlServerCe.dll file

Is This A Good Question/Topic? 0
  • +

Replies To: Problem in Setup file

#2 prasad.weer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 10-November 11

Re: Problem in Setup file

Posted 17 November 2011 - 07:25 AM

Please Help me.... Why can't i use installed exe file? how to fix that error....?
Was This Post Helpful? 0
  • +
  • -

#3 prasad.weer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 10-November 11

Re: Problem in Setup file

Posted 29 November 2011 - 09:41 AM

Please Help me....

Please Help me....

Please Help me....
Was This Post Helpful? 0
  • +
  • -

#4 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 458
  • View blog
  • Posts: 4,222
  • Joined: 25-March 09

Re: Problem in Setup file

Posted 29 November 2011 - 11:23 AM

try using Application.StartupPath and see if it will work
Was This Post Helpful? 0
  • +
  • -

#5 prasad.weer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 46
  • Joined: 10-November 11

Re: Problem in Setup file

Posted 30 November 2011 - 10:23 PM

I tried it as well. but not work.
then I hard coded database path like this.

 sqlcon = New SqlCeConnection("Data Source=C:\stuDB.sdf") ' This path has the database


It also didn't work. (it is shown same error)
Then i copy my database to "D" partition and change conection string like this.
Data Source=D:\stuDB.sdf

It is working well. The problem is i cannot insert the database into my primary partition. So how to correct it?
Was This Post Helpful? 0
  • +
  • -

#6 _HAWK_  Icon User is online

  • Master(Of Foo)
  • member icon

Reputation: 959
  • View blog
  • Posts: 3,688
  • Joined: 02-July 08

Re: Problem in Setup file

Posted 30 November 2011 - 10:53 PM

You change the connection string to match the directory your database lives in - like NoBrain said. You can move the sdf to the debug folder for testing your program as well. You just need to increase the version number on the setup project and allow the product number to change when it asks then you have made your first update.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1