Click here to Skip to main content
13,250,043 members (70,231 online)
Rate this:
Please Sign up or sign in to vote.
See more: , +

I jave a problem with sql script run.
My script is not running with .Net Windows Application Setup.
I have created Installer class for SQL Script, but my database not attaching.

So, please help me.
How could that possible?

Thank U.
Ankit Agarwal
Software Engineer
Posted 3-Jan-13 20:33pm
Orcun Iyigun 4-Jan-13 2:15am
Since you haven't explained the specific error and provided a code. This can be general but have a look at this following link[^]. A link you may want to compare your code with:
Deploy SQL Server databases easily with an Installer class[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Rate this: bad
Please Sign up or sign in to vote.

Solution 2


You can use from bellow class for manage that.

    public class DBManagement
        public SqlConnection OpenConnection()
            string connectionString = "Data Source = [YourServerName]; Initial Catalog = [YourDatabaseName]; User ID = [YourSqlUserName]; Password = [YourSqlUserPassword]";
            SqlConnection connection = null;
                connection = new SqlConnection(connectionString);
                Console.WriteLine("DataBase is not reachable....");
            return connection;
        public DataTable Execute(string queryString)
            SqlConnection connection = OpenConnection();
            SqlCommand query = new SqlCommand(queryString, connection);
            DataTable resultTable = new DataTable();
            SqlDataAdapter adopter = new SqlDataAdapter(query);
            return resultTable;

You can send [youparameter] directly to your methods of this class.

I hope it's helpful.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171114.1 | Last Updated 4 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100