6 Replies - 4693 Views - Last Post: 04 May 2010 - 09:41 PM Rate Topic: -----

#1 Fiodor941  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 03-May 10

VB Login Mysql

Posted 03 May 2010 - 06:10 PM

Hey guys!

I am trying to make a login system mysql try to connect to a mysql database.

Here is my code:

Imports MySql.Data.MySqlClient
Public Class LoginForm1
    Dim MySqlConnection As MySqlConnection
    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
        MySqlConnection = New MySqlConnection()

        MySqlConnection.ConnectionString = "server=***************; user id=**********; password=**; database=fpsskill_n;"
        Try
            MySqlConnection.Open()
            MessageBox.Show("Connection to Database has been opened.")
        Catch myerror As MySqlException
            MessageBox.Show("Cannot connect to database: " & myerror.Message)
        End Try
        Dim myadapter As New MySqlDataAdapter
        Dim sqlquary = "SELECT * FROM user WHERE username = '" & UsernameTextBox.Text & "' AND password = '" & PasswordTextBox.Text & "';"
        Dim command As New MySqlCommand
        command.Connection = MySqlConnection
        command.CommandText = sqlquary
        myadapter.SelectCommand = command
        Dim mydata As MySqlDataReader
        mydata = command.ExecuteReader()
        If mydata.HasRows = 0 Then
            MsgBox("Invalid user")
        Else
            MsgBox("Welcome user")
        End If
    End Sub
End Class


And when i send it to my friends it give them a error:

Look the image:

Is there anyway to fix it?

Thank you!

Attached image(s)

  • Attached Image

This post has been edited by Fiodor941: 03 May 2010 - 06:11 PM


Is This A Good Question/Topic? 0
  • +

Replies To: VB Login Mysql

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1638
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: VB Login Mysql

Posted 03 May 2010 - 06:15 PM

Well unless you created an installer then your friend needs to download the .Net MySql Connector and install it in order to be able to access it, that error says the file cannot be loaded because it doesn't exist.
Was This Post Helpful? 0
  • +
  • -

#3 Fiodor941  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 03-May 10

Re: VB Login Mysql

Posted 03 May 2010 - 06:18 PM

Is there any other way?
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1638
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: VB Login Mysql

Posted 03 May 2010 - 06:22 PM

Unless you create an installer to run your application on a different computer that registers the MySql dll then no
Was This Post Helpful? 0
  • +
  • -

#5 Fiodor941  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 03-May 10

Re: VB Login Mysql

Posted 03 May 2010 - 06:25 PM

Oh ok!

Thank you alot :)

And have a good day.
Was This Post Helpful? 0
  • +
  • -

#6 Ändrew  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 25
  • View blog
  • Posts: 312
  • Joined: 21-April 08

Re: VB Login Mysql

Posted 04 May 2010 - 07:03 PM

You can click on the refrence and set the property CopyLocal and make it true.
Then copy all the contence of the built version into a zip and send it to them.
Was This Post Helpful? 0
  • +
  • -

#7 PDUNZ  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 43
  • View blog
  • Posts: 372
  • Joined: 17-July 09

Re: VB Login Mysql

Posted 04 May 2010 - 09:41 PM

You dont need to download the whole Mysql installer package to install it on a clients machine (the mysql installer is just the SDK which isnt needed on the client), As Andrew has said all you need is to include the Mysql DLL with your program and install it either in the program's directory or System32 folder.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1