Try this connection string .. First make a test form with four text labels. Database server, database name, user id and password
private void button_test_Click(object sender, EventArgs e)
{
try
{
string str = "data source=" + textBox_server.Text + "; initial catalog=" + textBox_db.Text
+ "; user id=" + textBox_user.Text + "; pwd=" + textBox_password.Text + ";";
SqlConnection sqlcon = new SqlConnection(str);
sqlcon.Open();
sqlcon.Close();
MessageBox.Show("Test Connection was successfull");
}
catch (Exception ex)
{
MessageBox.Show("Test Connection failed. "+ ex.Message);
}
}
then add this and test .
Please use the correct database name and server, and please do check regarding the authentication of serve
While doing the remote connection at that time please make sure to enter correct database server name or ip of it, and correct table name. With this test you can verify the connection from c# to your code