Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have created a software with database?

at my office there are 10 people work with me?
so i created that software to internal purpose

sql located in my pc.

after i installed software to another pc, it will be able to access my pc sql database?

how can i do that?

C#
string connetionString = null;

            //string sql = null;
            string name = "";
            string pass = "";

            connetionString = "Data Source=172.21.1.91;Initial Catalog=EnqInfo;Network Library=DBMSSOCN;Integrated Security=SSPI";


            using (SqlConnection con = new SqlConnection(connetionString))
            {
                //
                // Open the SqlConnection.
                //
                con.Open();
                //
                // The following code uses an SqlCommand based on the SqlConnection.
                //
                using (SqlCommand command = new SqlCommand("SELECT * FROM Login WHERE U_Name=@Usr", con))
                    {

                        command.Parameters.AddWithValue("@Usr", UName.Text);
                        SqlDataReader reader = command.ExecuteReader();
                        while (reader.Read())
                        {
                            name = reader.GetString(1);  // Name string
                            pass = reader.GetString(2); // Password string
                        }

                        if (name == UName.Text && pass == PWord.Text)
                        {

                            ClassEnq.Uname = UName.Text;
                            MessageBox.Show("Password Accepted");
                            this.Close();
                            setEnableToolStripMenuItem(true);
                            setEnableToolStripMenuItem1(true);
                            setDisableToolStripMenuItem(false);

                        }

                        else
                        {
                            MessageBox.Show("Password Incorrect, Please Re-Enter Your Password");
                            setEnableToolStripMenuItem(false);
                            setEnableToolStripMenuItem1(false);
                        }
                    }



i have given my ip for data source?

i have configured firewall settings.
enabled tcp/ip using sql sever configure manager.

i have tried many ways

i'm using sql server 2008 r2

what can i do for this, please help me to solve this?
Posted
Comments
Praveen Kumar Upadhyay 19-Jan-15 6:39am    
It should work. What error you are getting when trying to connect sql server from another system.
Hemas Ilearn 20-Jan-15 6:37am    
please give me a solution... any solution couldn't help me properly?

Have you tried to connect with sql management studio? may be sql service is stopped, wrong ip, or another detail.
 
Share this answer
 
Comments
Praveen Kumar Upadhyay 19-Jan-15 7:17am    
Not an answer at all. If you are not clear with the question or want to ask something to OP then drop comment.
Hemas Ilearn 20-Jan-15 6:37am    
please give me a solution... any solution couldn't help me properly?
I assume you did not grant permissions to your users.
Please have a look at this:
http://www.quackit.com/sql_server/sql_server_2014/tutorial/sql_server_user_logins.cfm[^]
It is about SQL Server 2014, but the configuration of SQL Server 2008 R2 is very similar.
 
Share this answer
 
v2
Comments
Hemas Ilearn 20-Jan-15 6:37am    
please give me a solution... any solution couldn't help me properly?

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900