include sql db within package and install on a standalone system with no sql server

sid

Member
Joined
Sep 16, 2011
Messages
13
Programming Experience
Beginner
Hi,
i have develop an window application using **VB.NET** and** SQL SERVER2008R2**.I have Sql server2008R2 installed on my system containing sql database file.I have my connectionstring in app.config file as:-

VB.NET:
<appSettings>

                                  <add key="mycon" value="Data Source=My-pc;Initial Catalog=MovieCatalog;User ID=sa;Password=pwd123" />
                                  <add key="ClientSettingsProvider.ServiceUri" value="" />
                  </appSettings>

Now what i want to do is to make setup of my project.My problem is that how to include all files(including sql database file) or what to do to make setup or package.
Secondly,this is single user application with no LAN or network etc., so is it necessary to install sql server on different PC before installing this package?
I mean how can i include my database file within package(so that my connectionstring work properly) without even installing sql server on user PC or tell me what to do rightly to make appropriate package.
 
It sounds like you are trying to attach the database with a name that matches another database that is already attached. Each database name must be unique. Do you perhaps still have your original database with the same name attached to the same instance?
 
It sounds like you are trying to attach the database with a name that matches another database that is already attached. Each database name must be unique. Do you perhaps still have your original database with the same name attached to the same instance?

Finally i made it....taken a long time but i succeeded in attaching my database file to the instance of sqlserver.I put my database files in a folder 'db' and add it into bin\debug folder of my project and change the app.config file as below:
VB.NET:
<appSettings>
        <add key="mycon" value="Data Source=.\sqlexpress;Integrated Security=True;AttachDbFilename=|DataDirectory|\db\MovieCalalog.mdf
Trusted_Connection=Yes;user instance=true" />
        <add key="ClientSettingsProvider.ServiceUri" value="" />
    </appSettings>
Now what i see is that my application is working fine when run through Visual Studio but when published and then install to run on my pc,it still gives the same error(almost) that i was getting previously as:
VB.NET:
An Attempt to attach an auto-named database for file C:\Users\Sid\AppData\Local\Apps\2.0\Data\TKDL3G.............   ........\Data\db\MovieCalalog.mdf failed.
A database with the same name exists,or specified file cannot be opened,or it is located on UNC share.
Where's the Problem now??
I will realy appreciate ur reply this time too........
 
Back
Top