06-30-2011, 01:51 PM
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 <!-- s --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="" title="Smile" /><!-- s --> heres All my LoginForm1 Code
A ERROR hits me in the face AFTER clicking the Login button, and a new form pops up (Mysqlconnection.vb)
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