Hello everybody I posted this tutorial because i wanted to learn this before but i can't find the solution on any site or forum.
This will teach you
1.to make a MySQL Database for free
2.Make a login form for your program so no one can use this program except users on the database
Watch this video to know how:
http://searchico.x10.mx/DB2.html
Here is the source code:
Code:Imports System.Data.SqlClient 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) Me.Close() End Sub Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.Close() End Sub Private Sub Cancel_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click End End Sub Private Sub OK_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click MySQLConnection = New MySqlConnection MySQLConnection.ConnectionString = "server=db4free.net;Port=3306; User ID=db4freeusername; password=db4freepassword; database=nameofyourdatabase" MySQLConnection.Open() Dim MyAdapter As New MySqlDataAdapter Dim SqlQuary = "SELECT * From nameofthetable 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("Error During Login:Please Enter Valid Data") Else Form1.Show() Me.Hide() End If End Sub End Class
Hope that this helped
Please stick my topic


Reply With Quote
