0
SqlConnection con = new SqlConnection("server=192.168.0.100,1400;user=Users;password=password;database=Example1;integrated security = true;");

SqlDataAdapter sda = new SqlDataAdapter();
DataTable dbdataset = new DataTable();

BindingSource bsource = new BindingSource();
SqlCommand cmd = new SqlCommand();

public void loaddata()
{
    try
    {
        SqlCommand cmdatabbase = new SqlCommand(" select * from Example1.dbo.Users ;", con);

        sda.SelectCommand = cmdatabbase;

        sda.Fill(dbdataset);

        bsource.DataSource = dbdataset;
        dataGridView1.DataSource = bsource;
    }
    catch (Exception ex)
    {
       MessageBox.Show(ex.ToString());
    }

This is my code in C# Winforms application. On my computer it is working but from another computer it shows error (it can't load table in datagridview). I added rule in firewall and I enable tcp in SQL Server Configuration Manager but it still doesn't work! I tried every solution that found in internet but it didn't work.

a busy cat http://non-98.ucoz.com/Untitled5.jpg

I saw this in another computer when running a program.

10
  • So....What's the exception message? Commented Nov 24, 2013 at 9:10
  • Give us more details. What is the error? On which line do you get ? Commented Nov 24, 2013 at 9:12
  • What's that 1400 in ip? Commented Nov 24, 2013 at 9:16
  • @Sudhakar Just want to ask....did you mess up " User2012384" with "user2971569"? Commented Nov 24, 2013 at 9:18
  • Try removing "integrated security = true", see if it works.. Commented Nov 24, 2013 at 9:22

2 Answers 2

1

You must change the integrated security from true to false. Check this connection strings

Sign up to request clarification or add additional context in comments.

3 Comments

can I use public ip address and my port as my sql server name in managment studio
I just used in your link this "Connect via an IP address" constring And used my public ip and it worked!!!
And also check that port 1400 open in firewall of each computer
0

I think this is due to accessibility of the sever.Try either integrated security =False or update connection string

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.