Mysql in vb.net2008 on vista then its give error(Unable to connect to any of the specified MySQL hosts.)
-
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
-
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
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.
-
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.
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) -
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
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.
-
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
-
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
I see 1 posibility that spring to my mind. - MySql Connector is not installed on your Vista.