Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DataBase - Login - Not Working
#1
been working on this for about 4 days now and im still running in circles. There are several ways to do this and so it seem Brands method is the best. However, Im getting errors. If anyone is bored and would like to help i would appreciate it. Also If somone has Voice Program. I can join that as well, This Forum should run its own Ventrilo .... just saying <!-- sSmile --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="Smile" title="Smile" /><!-- sSmile --> heres All my LoginForm1 Code

Code:
Imports MySql.Data.MySqlClient
Public Class Loginform1

    Public conn As MySqlConnection
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        conn = New MySqlConnection("server=db4free.net;Port=3306; user id=*****; password=*****; database=SamUsers")
        Dim username As Boolean = True
        conn.Open()
        Dim sqlquery As String = "SELECT * FROM NewTable WHERE Username = '" & TextBox1.Text & "';"
        Dim data As MySqlDataReader
        Dim adapter As New MySqlDataAdapter
        Dim command As New MySqlCommand
        command.CommandText = sqlquery
        command.Connection = conn
        adapter.SelectCommand = command
        data = command.ExecuteReader
        While data.Read()
            If data.HasRows() = True Then
                MsgBox("Username Already in use!")
                username = False
                data.Close()
            Else
                data.Close()
                username = True
            End If
        End While
        data.Close()
        If username = True Then
            Dim sqlquery2 As String = "INSERT INTO NewTable (Username, Password)VALUES ('" & TextBox1.Text & "','" & TextBox2.Text & "')"
            Dim data2 As MySqlDataReader
            Dim adapter2 As New MySqlDataAdapter
            Dim command2 As New MySqlCommand
            command2.CommandText = sqlquery2
            command2.Connection = conn
            adapter2.SelectCommand = command2
            data2 = command2.ExecuteReader
            MsgBox("You've Registered!")
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://h1.ripway.com/murcs/SQLDatabaseProject.txt")
        Dim response As System.Net.HttpWebResponse = request.GetResponse()

        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())

        Dim newestversion As String = sr.ReadToEnd()
        Dim currentversion As String = Application.ProductVersion

        If newestversion.Contains(currentversion) Then
            MessageBox.Show("You have the current version")
        Else
            MessageBox.Show("Newer version available please wait for install to begin")

            Me.Close()

            My.Computer.Network.DownloadFile("http://h1.ripway.com/murcs/Sam v.1.0.0.1.exe", "C:\Sam v.1.0.0.1.exe")
            Process.Start("C:\Sam v.1.0.0.1.exe")

        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        RegisterForm.Show()
    End Sub
End Class


A ERROR hits me in the face AFTER clicking the Login button, and a new form pops up (Mysqlconnection.vb)

Code:
Public Class MySqlConnection

    Private _p1 As String

    Sub New(ByVal p1 As String)
        ' TODO: Complete member initialization
        _p1 = p1
    End Sub

    Sub Open()
        Throw New NotImplementedException
    End Sub

End Class
#2
Hey Murc!

Well, it doesn't really look like there is a problem with your form1 login code... Everything looks like it checks out there. You might want to make sure that the connection string is good, though.

As for the second form, I don't know if you ever called it, but
Code:
Sub Open()
        Throw New NotImplementedException
    End Sub

Will actually throw an error I believe, so that could be it.

What is the error you are getting, exactly?
My Blog | My Setup | My Videos | Have a wonderful day.
#3
Part of my problem i think is the database it self. If the loginform1 code is Good... Then Database1 is not working properly. I wont be able to get back to this project till After the 4th of july. But if anyone gets bored or wants to help the Database needs to be replaced or fixed. Its just a test database so im not worried about the broken database or the account.

Login @ <!-- m --><a class="postlink" href="http://www.db4free.net/">http://www.db4free.net/</a><!-- m -->
user = murcs
pass = annika420

If you can get data entered to the database from your Form that would be great...

Also the error is: (The method or operation is not implemented), folowed by a new form that opens called:

Code:
Public Class MySqlConnection

    Private _p1 As String

    Sub New(ByVal p1 As String)
        ' TODO: Complete member initialization
        _p1 = p1
    End Sub

    Sub Open()
        Throw New NotImplementedException
    End Sub

End Class

By the way.. Big thanks for the videos and assistance i really appreciate. cyas on Tuesday.....
#4
Can you give us your table information?
Website: <!-- m --><a class="postlink" href="http://www.PBAProductions.com">http://www.PBAProductions.com</a><!-- m -->
E-Mail: <!-- e --><a href="mailtoTongueatrick@AriSystems.Org">Patrick@AriSystems.Org</a><!-- e -->
Skype: Qwaxer
Youtube: Qwaxer
[Image: 2hnx8av.jpg]
#5
Well here is one error, in your code you are trying to do everything to a table labeled, NewTable... However, the table on your database is actually called Users.
My Blog | My Setup | My Videos | Have a wonderful day.


Possibly Related Threads…
Thread Author Replies Views Last Post
  2 Listboxes and database qazinasir 7 25,878 07-22-2012, 09:41 PM
Last Post: brandonio21
  [SOLVED] Interation Not Working kismetgerald 9 31,422 01-20-2012, 04:30 AM
Last Post: kismetgerald
  VB2010 & MS Access Database kismetgerald 3 14,647 01-10-2012, 10:35 PM
Last Post: kismetgerald
  others can't connect to online database Stefanvp 3 14,506 08-14-2011, 09:46 PM
Last Post: brandonio21
  connect to online database elnashar77 3 14,674 08-09-2011, 01:27 PM
Last Post: brandonio21
  Working with Regex xolara 2 11,837 02-24-2011, 05:38 PM
Last Post: xolara

Forum Jump:


Users browsing this thread: 1 Guest(s)