View Poll Results: Did this help u?

Voters
6. You may not vote on this poll
  • Yes

    5 83.33%
  • No

    1 16.67%
Results 1 to 5 of 5

Thread: Make a free online database + Make a VB.NET login form to connect to this database

  1. #1
    Addicted Member
    Join Date
    Aug 10
    Posts
    137

    Exclamation Make a free online database + Make a VB.NET login form to connect to this database

    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
    Last edited by salmawy; Sep 15th, 2010 at 11:33 AM.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 02
    Location
    Bristol, UK
    Posts
    35,568

    Re: Make a free online database + Make a VB.NET login form to connect to this databas

    Thread moved to the 'CodeBank VB.Net' forum (which where working code examples belong)

  3. #3
    Junior Member
    Join Date
    Sep 10
    Posts
    21

    Re: Make a free online database + Make a VB.NET login form to connect to this databas

    followed the tut and when i click ok to login i get a error this is the error,can you please help me i need to get my login working as fast as i can

    thanks dale


    MySql.Data.MySqlClient.MySqlException was unhandled
    ErrorCode=-2147467259
    Message=Table 'igar_users.login' doesn't exist
    Number=1146
    Source=MySql.Data
    StackTrace:
    at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
    at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)
    at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()
    at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
    at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
    at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()
    at WindowsApplication1.LoginForm1.OK_Click_1(Object sender, EventArgs e) in C:\Users\Dale\documents\visual studio 2010\Projects\Ig Auto Ranker V2\Ig Auto Ranker V2\LoginForm1.vb:line 25
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnClick(EventArgs e)
    at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ButtonBase.WndProc(Message& m)
    at System.Windows.Forms.Button.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.Run(ApplicationContext context)
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    InnerException:

  4. #4
    Junior Member
    Join Date
    Sep 10
    Posts
    21

    Re: Make a free online database + Make a VB.NET login form to connect to this databas

    doesnt matter fixed it i have the wrong table name silly me

  5. #5
    Addicted Member spyk3's Avatar
    Join Date
    Apr 09
    Location
    Dothan, AL
    Posts
    217

    Re: Make a free online database + Make a VB.NET login form to connect to this databas

    Lol, was gonna say, the most important part of your stacktrace there is
    Message=Table 'igar_users.login' doesn't exist

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •