Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[TUT] Remote MySql Database Login[/TUT]

Welcome To My Latest Tutorial With Visual Basic 2010
MySQL Login (with progressbar)

NOTE: The Codes In This Tutorial Are Codes That I Have Gathered Through Diffrent Source(s).

Also There Are Loads Of People Asking About These Features Here On HF So This Has Gave Me The Idea To Write This Tutorial.

---------------------------------

Download MySql Connector Here: DOWNLOAD

--------------
Form 1 Code:
--------------

Add The MySql.Data.dll To Your Project (Project>Add Reference>Browse>C:\Program Files\MySQL\MySQL Connector Net 6.4.3\Assemblies\v4.0\MySql.Data.dll)

Add: 2 Labels(username, password), 2 Textbox's(username, password), 1 Timer, 1 ProgressBar, 2 Buttons(login, exit).

Set Timer1's Properties To Enabled:False & Interval:100

Double Click Your Form To Bring Up The Source And Paste This Code In (Replace "server=yourserver.com; Port=3306; user id=username; password=password; database=database" And "Dim sqlquary = "SELECT From database WHERE Username='" & TextBox1.Text & "'AND Password='" & TextBox2.Text & "';"" Explained Below)

Code
Imports System.Data.SqlClient
Imports MySql.Data.MySqlClient
Public Class Form1
    Dim MySqlConnection As MySqlConnection
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MySqlConnection = New MySqlConnection
        MySqlConnection.ConnectionString = "server=yourserver.com; Port=3306; user id=username; password=password; database=database"
        MySqlConnection.Open()

        Dim Myadapter As New MySqlDataAdapter
        Dim sqlquary = "SELECT * From database WHERE Username='" & TextBox1.Text & "'AND Password='" & TextBox2.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("Error Wrong Login Information", MsgBoxStyle.Exclamation)
        Else
            Timer1.Start()
        End If
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        End
    End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Increment(1)
        If ProgressBar1.Value = ProgressBar1.Maximum Then
        MsgBox("Logged In")
        End If
    End Sub
End Class

---------------
Database Tips:
---------------

To Setup A Free Database With db4free.net For This Tutorial Simply Register Then Log In And Create A New Table Called "login" Without Quotes With 3 Columns.

Column 1 Name: ID, Type: INT, Length/Values: 155, Index: Primary, A_I: Checked
Column 2 Name: Username, Type: TEXT, Length/Values: 25
Column 3 Name: Password, Type: TEXT, Length/Values: 25

Where Does All This Information Go? Remember At The Top I Told You To Rename Some Things To Your Info Well I'l Help You Out With That Now,

Ok Just Say My Username On db4free.net Was "tutorial" And My Password Was "changeme" And The Table I Created Was As Above "login" Then I Would Set My MySql Connectionstring As:

server=db4free.net; Port=3306; user id=tutorial; password=changeme; database=tutorial
Dim sqlquary = "SELECT
From login WHERE Username='" & TextBox1.Text & "'AND Password='" & TextBox2.Text & "';"

-----------------------------

I Hope This Tutorial Was Explained Enough And Also Helped Some Of You With Your Questions.
I Will Not Stop Writing Tutorials As I Love Helping People.
Thanks For Reading :)
Way to rip the Code, and tools and whole process right off youtube...

Μouse Wrote:  That's wrong. I don't have proof for that, it should just be common knowledge that it's wrong.

You don't get respect on HF for ripping others work, and show us it. We others know how to do a google search or self.
(Aug 29, 2011 11:51 PM)Menalix Wrote:  You don't get respect on HF for ripping others work, and show us it. We others know how to do a google search or self.

its not ripping other people's work, it's sharing what i have learned.

(Aug 29, 2011 11:22 PM)Chappie Wrote:  Way to rip the Code, and tools and whole process right off youtube...

i didn't get this from youtube, i got parts from diffrent websites, to name a few, vbexplorer, xtremevbtalk, dreamincode.

rant over!
Way to look at a vid, type it, and rip all the tools and codes, go away.
nice tutorial ..thank you
The message is NOT
==

(Aug 30, 2011 04:54 AM)Gold Lion Wrote:  its not ripping other people's work, it's sharing what i have learned.

So how come you haven't put any credits?
(Aug 30, 2011 05:31 AM)Nazworth Wrote:  So how come you haven't put any credits?

dude read up at the beginning :)

"NOTE: The Codes In This Tutorial Are Codes That I Have Gathered Through Diffrent Source(s)."
(Aug 30, 2011 05:31 AM)Nazworth Wrote:  So how come you haven't put any credits?

With this logic, you're essentially saying that everytime you make something for, say, your job in real life, that you have to credit your college professors and high school teachers because they taught you it.

Does that sound right?
Btw for making this stronger use HWID and encrypt every string to MD5 :)
Thanks a lot for this tut i will surely use in in the future :)
I bet 80% of HF never Googles considering the questions in this damn section. =P
ok this is the error you have and error in your sql syntax check the manual that corresponds to your Mysql server version for the syntax to user near ;database where Username"And Password" at line 1
[Image: MW3lGyc.png]
This is a completely useless tutorial. Why? No one else can use this program. Why? The file you're using, mysql.data.dll, fucks up the program. It gives the other users some sort of error when they open the program. Don't waste your time.
(Jan 22, 2012 09:52 PM)Percocet Wrote:  This is a completely useless tutorial. Why? No one else can use this program. Why? The file you're using, mysql.data.dll, fucks up the program. It gives the other users some sort of error when they open the program. Don't waste your time.

Well you could download mysql.data.dll and add it as normal. It will work and this is not useless or "a waste of time".


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by optionalMay 21, 2021 08:42 AM 7 310 May 21, 2021 08:42 AM
Last Post: Charger
[C] by MeterpreterJun 27, 2018 09:06 PM 17 528 Jun 27, 2018 09:06 PM
Last Post: Meterpreter
[C] by MeterpreterJun 27, 2018 02:10 AM 0 188 Jun 27, 2018 02:10 AM
Last Post: Meterpreter