How can check the result of the TCP/IP connection???,
-
Hi, I wanna ask How can I verify that my TCP/IP connection to the server is working well??? My code is:
string sConnection = "Provider=SQLNCLI.1;Persist Security Info=False;User ID=sa;Initial Catalog=GMAO;Data Source=127.0.0.1,1433;Password=sa;";
string sSQL = "SELECT com FROM energie; ";
SqlConnection conn = new SqlConnection(sConnection);
SqlCommand comm = new SqlCommand(sSQL, conn);
DataSet ds = new DataSet();SqlDataAdapter da = new SqlDataAdapter(sSQL,conn); SqlDataReader dr = null; try { comm.Connection.Open(); da.Fill(ds, "SQL Temp Table"); foreach (DataRow d in ds.Tables\[0\].Rows) { MessageBox.Show("xxxx"); comboBox1.Items.Add(d.ItemArray\[0\].ToString()); } } catch (SqlException ex) { MessageBox.Show("connexion impossible"); MessageBox.Show(ex.Message); return; } dr.Close(); comm.Connection.Close();
the error that must appears when connection is failed doesn't existe when running,IS it an indice that my connection goes well?? When googling,I found that the job activity monitor in the sql server management indicates that.is that true??how can I use that in checking my connection result??? Thanks :)
-
Hi, I wanna ask How can I verify that my TCP/IP connection to the server is working well??? My code is:
string sConnection = "Provider=SQLNCLI.1;Persist Security Info=False;User ID=sa;Initial Catalog=GMAO;Data Source=127.0.0.1,1433;Password=sa;";
string sSQL = "SELECT com FROM energie; ";
SqlConnection conn = new SqlConnection(sConnection);
SqlCommand comm = new SqlCommand(sSQL, conn);
DataSet ds = new DataSet();SqlDataAdapter da = new SqlDataAdapter(sSQL,conn); SqlDataReader dr = null; try { comm.Connection.Open(); da.Fill(ds, "SQL Temp Table"); foreach (DataRow d in ds.Tables\[0\].Rows) { MessageBox.Show("xxxx"); comboBox1.Items.Add(d.ItemArray\[0\].ToString()); } } catch (SqlException ex) { MessageBox.Show("connexion impossible"); MessageBox.Show(ex.Message); return; } dr.Close(); comm.Connection.Close();
the error that must appears when connection is failed doesn't existe when running,IS it an indice that my connection goes well?? When googling,I found that the job activity monitor in the sql server management indicates that.is that true??how can I use that in checking my connection result??? Thanks :)
well firstly 127.0.0.1 is a ping back address.. to programatically ping an address have a look at this example ping example what is the error message that you are getting?
Marc Clifton wrote:
That has nothing to do with VB. - Oh crap. I just defended VB!
-
well firstly 127.0.0.1 is a ping back address.. to programatically ping an address have a look at this example ping example what is the error message that you are getting?
Marc Clifton wrote:
That has nothing to do with VB. - Oh crap. I just defended VB!
Hi, I wanna explain to u something:First,I work with the defualt instance of sql server 2005.So the server availabe is:Admin-PC\MSSQLSERVER that indicates a local IP@=127.0.0.1,1433.Is that true or I am wrong in my behavior? Second,what u mean by ping back @?? Third,bebore attaching my database,the error"**Specified sql server not found or access denied"**annoys me.after the attachemment,no exception appears(in the catch block of my code)but still my combobox not filled by data from database. Thanks a lot :)
-
Hi, I wanna explain to u something:First,I work with the defualt instance of sql server 2005.So the server availabe is:Admin-PC\MSSQLSERVER that indicates a local IP@=127.0.0.1,1433.Is that true or I am wrong in my behavior? Second,what u mean by ping back @?? Third,bebore attaching my database,the error"**Specified sql server not found or access denied"**annoys me.after the attachemment,no exception appears(in the catch block of my code)but still my combobox not filled by data from database. Thanks a lot :)
127.0.0.1 is normally an address you use to test a machines network card. if you run a command prompy and type ipconifg you will see your network address is different. on your connection string i would change the ip address for the name of the machine and try that
Marc Clifton wrote:
That has nothing to do with VB. - Oh crap. I just defended VB!
-
Hi, I wanna ask How can I verify that my TCP/IP connection to the server is working well??? My code is:
string sConnection = "Provider=SQLNCLI.1;Persist Security Info=False;User ID=sa;Initial Catalog=GMAO;Data Source=127.0.0.1,1433;Password=sa;";
string sSQL = "SELECT com FROM energie; ";
SqlConnection conn = new SqlConnection(sConnection);
SqlCommand comm = new SqlCommand(sSQL, conn);
DataSet ds = new DataSet();SqlDataAdapter da = new SqlDataAdapter(sSQL,conn); SqlDataReader dr = null; try { comm.Connection.Open(); da.Fill(ds, "SQL Temp Table"); foreach (DataRow d in ds.Tables\[0\].Rows) { MessageBox.Show("xxxx"); comboBox1.Items.Add(d.ItemArray\[0\].ToString()); } } catch (SqlException ex) { MessageBox.Show("connexion impossible"); MessageBox.Show(ex.Message); return; } dr.Close(); comm.Connection.Close();
the error that must appears when connection is failed doesn't existe when running,IS it an indice that my connection goes well?? When googling,I found that the job activity monitor in the sql server management indicates that.is that true??how can I use that in checking my connection result??? Thanks :)
May be of some use. We have recently released a Free tool to check conection strings. It won't debug the TCP/IP stream, but will help you see the database at the other end. http://www.citrustechnology.com/product/data-provider-explorer