Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How can check the result of the TCP/IP connection???,

How can check the result of the TCP/IP connection???,

Scheduled Pinned Locked Moved Database
questiondatabasesql-servercomsysadmin
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tunisien86
    wrote on last edited by
    #1

    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 :)

    S C 2 Replies Last reply
    0
    • T Tunisien86

      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 :)

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      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!

      T 1 Reply Last reply
      0
      • S Simon_Whale

        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!

        T Offline
        T Offline
        Tunisien86
        wrote on last edited by
        #3

        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 :)

        S 1 Reply Last reply
        0
        • T Tunisien86

          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 :)

          S Offline
          S Offline
          Simon_Whale
          wrote on last edited by
          #4

          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!

          1 Reply Last reply
          0
          • T Tunisien86

            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 :)

            C Offline
            C Offline
            CitrusTech
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups