User_90 Posted September 15, 2011 Share Posted September 15, 2011 MySQL Version:5.0.2 Guys, Thats about all i can tell you, that i know. My problem is this. I am trying to follow this userguide (http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-3), to basically build an application that will allow users to connect to my database, from an exe file. I'll try to explain as best i can. The plan is, users will launch an exe file that i have built in Visual Basic(VB) 2010 Express. When they launch the application The first thing they see will be: I am following the example guide (see link above), and will customise it once i can connect to the database. For some reason whenever i connect to the database it gives me two errors, the first is if i use the 'debug' mode in VB to test the script (note it doesn't produce any build errors), the second is if i build the application and run it as my users would. 1)Error Connecting to Database:Access denied for user 'mike'@'92.**.**.***' (using password:YES) 2)Error Connecting to Database:Unable to access any of the specified MySQL hosts Note:The ip address starred out (*) is my local machine ip address.The server is the server in which my Database runs on. 'mike' is a listed user on my 'user' table, the password i use is the password assigned to this user on my table. This user was added as part of the guide i've been following. What i've done to try and resolve it: 1)swear (alot) 2) Check my script in VB Build that database name,username etc is correct (see below for script) Imports MySql.Data.MySqlClient Public Class frmLogin Dim conn As MySqlConnection Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click Application.Exit() End Sub Private Sub Login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Login.Click conn = New MySqlConnection() conn.ConnectionString = "server=98.***.*.**:3306; user id=My Database User; password=********; database=********_in_out" & txtServer.Text & ";" _ & "user id=" & txtUsername.Text & ";" _ & "password=" & txtPassword.Text & ";" _ & "database=*******_in_out" Try conn.Open() MessageBox.Show("Connection Opened Successfully") conn.Close() Catch myerror As MySqlException MessageBox.Show("Error Connecting to Database: " & myerror.Message) Finally conn.Dispose() End Try End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click End Sub End Class Note: The ** information actually contains the correct information as per my Database, just removed the actual info to upload to here. 3)I've rebuilt the whole VB project, but still no joy, wern't expecting it to as there were no errors generated. 4) I've read, but don't really understand that it could be something to do with my database not being able to be controlled remotely, only locally. I started digging into 'Access Your MySQL Server Remotely Over SSH', didn't really know if i was going completely off the mark, it didn't mention needing to do any of this in the guide i've been following, but just a thought. It might be the case as i've tried to access my database through a programme called MySQL Administrator. I punch in the host,username etc and connect to my database, for some reason it won't allow me to add new users, could this be because i can't control my database remotely? Would this stop what i'm trying to do working? 5) When trying to install the MySQL.Data.dll file i had great difficulty in choosing one and finding it, adding it to my project using the 'Add reference' in VB. Finnally got it how it should be (i think), installed MySQL.Data.dll Ver 6.1.2.0 into my project. As you can probably tell i've got myself in a twist and am clutching at anything at the moment! I hope i've supplied sufficient information, but feel free to ask if you need any more. Many, Many thanks in advance Josh Quote Link to comment https://forums.phpfreaks.com/topic/247219-accessing-mysql-database-through-visual-basic-2010-express-help-required/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.