Varij Kapil

Varij Kapil

  • NA
  • 1
  • 1.7k

attach database to my setup in C#

Apr 10 2013 7:15 PM
hello all

i am new to C# programming.
i have developed a software that uses MS SQL Server for database connectivity.
my project is completed.
now i have to create a setup of it and submit it.
i know how to create a setup but what i dont know is how to attach my database with it so that when someone installs my software the database is automatically created on his system.
and then use the connection string which is already defined in the  program to connect to the database.the connection string takes server name as input from the user and the catalog is predefined in it.
need a solution that can cope up with this requirements.

i have surfed a lot of articles and forums and tried different things.
but all gave an error somehow.
tried to create a new database but didn't work out with my existing code.

tried to attach .mdf file to my solution but VS2010 gives error attaching the file.

pretty helpless now.

any help would be appreciated.
thanks in advance