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. General Programming
  3. C#
  4. Mysql in vb.net2008 on vista then its give error(Unable to connect to any of the specified MySQL hosts.)

Mysql in vb.net2008 on vista then its give error(Unable to connect to any of the specified MySQL hosts.)

Scheduled Pinned Locked Moved C#
csharpdatabasemysqlcom
6 Posts 6 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.
  • P Offline
    P Offline
    Piyush Vardhan Singh
    wrote on last edited by
    #1

    Hello Friend I am connectin Mysql in vb.net2008 on vista then its give error(Unable to connect to any of the specified MySQL hosts.) but whene i conectthis on xp os then its excute .... {} My Code- MySqlConnection _MySqlConnection; MySqlCommand _MySqlCommand; MySqlDataAdapter _MySqlDataAdapter; string _Conentionstring = "server=localhost;database=schoolinventory;user id=root;password=;"; public int GetId() { try { _MySqlConnection = new MySqlConnection(_Conentionstring); _MySqlConnection.Open(); string _Adpstring = "select Count(*) from goods"; _MySqlDataAdapter = new MySqlDataAdapter(_Adpstring, _Conentionstring); DataSet _ds=new DataSet(); _MySqlDataAdapter.Fill(_ds); int i = Convert.ToInt32( _ds.Tables[0].Rows[0].ItemArray[0].ToString()); return 0; } catch (Exception ex) { return 0; } }

    Piyush Vardhan Singh p_vardhan14@rediffmail.com Eventure Technology http://holyschoolofvaranasi.blogspot.com http://holytravelsofvaranasi.blogspot.com

    L B P M 4 Replies Last reply
    0
    • P Piyush Vardhan Singh

      Hello Friend I am connectin Mysql in vb.net2008 on vista then its give error(Unable to connect to any of the specified MySQL hosts.) but whene i conectthis on xp os then its excute .... {} My Code- MySqlConnection _MySqlConnection; MySqlCommand _MySqlCommand; MySqlDataAdapter _MySqlDataAdapter; string _Conentionstring = "server=localhost;database=schoolinventory;user id=root;password=;"; public int GetId() { try { _MySqlConnection = new MySqlConnection(_Conentionstring); _MySqlConnection.Open(); string _Adpstring = "select Count(*) from goods"; _MySqlDataAdapter = new MySqlDataAdapter(_Adpstring, _Conentionstring); DataSet _ds=new DataSet(); _MySqlDataAdapter.Fill(_ds); int i = Convert.ToInt32( _ds.Tables[0].Rows[0].ItemArray[0].ToString()); return 0; } catch (Exception ex) { return 0; } }

      Piyush Vardhan Singh p_vardhan14@rediffmail.com Eventure Technology http://holyschoolofvaranasi.blogspot.com http://holytravelsofvaranasi.blogspot.com

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      I suggest you stop swallowing exceptions like that. Add Console.WriteLine(ex.ToString()); or something similar and see what it tells you. :)

      Luc Pattyn [Forum Guidelines] [My Articles] [My CP bug tracking] Nil Volentibus Arduum

      Season's Greetings to all CPians.

      D 1 Reply Last reply
      0
      • L Luc Pattyn

        I suggest you stop swallowing exceptions like that. Add Console.WriteLine(ex.ToString()); or something similar and see what it tells you. :)

        Luc Pattyn [Forum Guidelines] [My Articles] [My CP bug tracking] Nil Volentibus Arduum

        Season's Greetings to all CPians.

        D Offline
        D Offline
        DaveyM69
        wrote on last edited by
        #3

        5 - agreed :thumbsup:

        Dave
        Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum. Astonish us. Be exceptional. (Pete O'Hanlon)
        BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

        1 Reply Last reply
        0
        • P Piyush Vardhan Singh

          Hello Friend I am connectin Mysql in vb.net2008 on vista then its give error(Unable to connect to any of the specified MySQL hosts.) but whene i conectthis on xp os then its excute .... {} My Code- MySqlConnection _MySqlConnection; MySqlCommand _MySqlCommand; MySqlDataAdapter _MySqlDataAdapter; string _Conentionstring = "server=localhost;database=schoolinventory;user id=root;password=;"; public int GetId() { try { _MySqlConnection = new MySqlConnection(_Conentionstring); _MySqlConnection.Open(); string _Adpstring = "select Count(*) from goods"; _MySqlDataAdapter = new MySqlDataAdapter(_Adpstring, _Conentionstring); DataSet _ds=new DataSet(); _MySqlDataAdapter.Fill(_ds); int i = Convert.ToInt32( _ds.Tables[0].Rows[0].ItemArray[0].ToString()); return 0; } catch (Exception ex) { return 0; } }

          Piyush Vardhan Singh p_vardhan14@rediffmail.com Eventure Technology http://holyschoolofvaranasi.blogspot.com http://holytravelsofvaranasi.blogspot.com

          B Offline
          B Offline
          Bernhard Hiller
          wrote on last edited by
          #4

          Do you have a MySQL server running on your Vista machine, with the same configuration and databases? At least your connection string says server=localhost. If it is on the XP machine only, you have to replace the name here, and you will likely have to some configuration on the server to allow connections from other computers. The Exception thrown will give you more details.

          1 Reply Last reply
          0
          • P Piyush Vardhan Singh

            Hello Friend I am connectin Mysql in vb.net2008 on vista then its give error(Unable to connect to any of the specified MySQL hosts.) but whene i conectthis on xp os then its excute .... {} My Code- MySqlConnection _MySqlConnection; MySqlCommand _MySqlCommand; MySqlDataAdapter _MySqlDataAdapter; string _Conentionstring = "server=localhost;database=schoolinventory;user id=root;password=;"; public int GetId() { try { _MySqlConnection = new MySqlConnection(_Conentionstring); _MySqlConnection.Open(); string _Adpstring = "select Count(*) from goods"; _MySqlDataAdapter = new MySqlDataAdapter(_Adpstring, _Conentionstring); DataSet _ds=new DataSet(); _MySqlDataAdapter.Fill(_ds); int i = Convert.ToInt32( _ds.Tables[0].Rows[0].ItemArray[0].ToString()); return 0; } catch (Exception ex) { return 0; } }

            Piyush Vardhan Singh p_vardhan14@rediffmail.com Eventure Technology http://holyschoolofvaranasi.blogspot.com http://holytravelsofvaranasi.blogspot.com

            P Offline
            P Offline
            phil o
            wrote on last edited by
            #5

            It could also be a firewall problem if the Windows Firewall blocks incoming requests on port 3306 (default port for MySQL services).

            1 Reply Last reply
            0
            • P Piyush Vardhan Singh

              Hello Friend I am connectin Mysql in vb.net2008 on vista then its give error(Unable to connect to any of the specified MySQL hosts.) but whene i conectthis on xp os then its excute .... {} My Code- MySqlConnection _MySqlConnection; MySqlCommand _MySqlCommand; MySqlDataAdapter _MySqlDataAdapter; string _Conentionstring = "server=localhost;database=schoolinventory;user id=root;password=;"; public int GetId() { try { _MySqlConnection = new MySqlConnection(_Conentionstring); _MySqlConnection.Open(); string _Adpstring = "select Count(*) from goods"; _MySqlDataAdapter = new MySqlDataAdapter(_Adpstring, _Conentionstring); DataSet _ds=new DataSet(); _MySqlDataAdapter.Fill(_ds); int i = Convert.ToInt32( _ds.Tables[0].Rows[0].ItemArray[0].ToString()); return 0; } catch (Exception ex) { return 0; } }

              Piyush Vardhan Singh p_vardhan14@rediffmail.com Eventure Technology http://holyschoolofvaranasi.blogspot.com http://holytravelsofvaranasi.blogspot.com

              M Offline
              M Offline
              Michael9000
              wrote on last edited by
              #6

              I see 1 posibility that spring to my mind. - MySql Connector is not installed on your Vista.

              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