Click here to Skip to main content
15,898,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello everybody ,

I am trying to make a simple application that interact to database SQL server, and it can run over a LAN. My ideas is use remote Connection by changing the Connection String like:
C#
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
          //  string strcon = ConfigurationManager.ConnectionStrings["strcon"].ConnectionString;
            string strcon="Data Source=192.168.1.36,1433;Network Library=DBMSSOCN;Initial Catalog=TracNghiem;Integrated Security=true;";
           // string strcon = "Server=.\\SQLEXPRESS;Database=TracNghiem;Integrated Security=true;";
            SqlConnection con;
            try
            {
                con = new SqlConnection(strcon);
                con.Open();
                MessageBox.Show("Connected Successfully");
            }
            catch(Exception xe)
            {
                MessageBox.Show("Error\n" + xe.Message);
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }

But I can run it successfully! My question : Is it possible ? And why I cann't run it !

Thanks for reading !
Posted
Updated 17-Oct-10 0:29am
v2

Will you and all users be on the same domain? What is your problem / error message?

I have set this up from another country using logmein free before. I would suggest that you setup DSN on each machine and make sure you test the connection.
 
Share this answer
 
v2
Also visit connectionstrings website
 
Share this answer
 

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