Vraag & Antwoord

Programmeren

Wat doe ik verkeerd

4 antwoorden
  • Ik wil een register form maken van visual basic maar wat doe ik verkeerd? [code:1:58933dd220] mysqlconnection = New MySqlConnection mysqlconnection.ConnectionString = "server=localhost;Port=3306; User ID=test; password=********; database=test" mysqlconnection.Open() Dim MyAdapter As New MySqlDataAdapter Dim SqlQuary = "INSERT INTO Users Set Username='" & UsernameTextBox.Text & "' AND password = '" & PasswordTextBox.Text & "';" Dim Command As New MySqlCommand ProgressBar1.Value = 20 Command.Connection = mysqlconnection ProgressBar1.Value = 30 Command.CommandText = SqlQuary ProgressBar1.Value = 50 MyAdapter.SelectCommand = Command ProgressBar1.Value = 70 Dim Mydata As MySqlDataReader ProgressBar1.Value = 85 Mydata = Command.ExecuteReader ProgressBar1.Value = 100 Catch ex As Exception MessageBox.Show(ex.Message)[/code:1:58933dd220] Ik krijg deze melding Truncated incorrect double value
  • Op welke regel gaat het fout? De foutmelding houdt in: Je hebt een double (een komma getal) en je stopt er een verkeerde waarde in. Probeer eens de 20 enzo in 20.0 of 20,0 te veranderen.
  • Het is al gelukt. Ik heb wel De hele code herschreven nu gaat het programma wel na of je een account hebt en volgens mij klopt de code redelijk ik krijg geen errors meer en hij werk op zichzelf goed (maar hij is wel een beetje langzaam) Het lag hier aan dit klopte eerst niet maar nu wel [code:1:a0af24714e]Dim SqlQuary = "INSERT INTO Users (Username, Password, Email) VALUES ('" & UsernameTextBox.Text & "','" & PasswordTextBox.Text & "','" & EMAIL.Text & "')" [/code:1:a0af24714e] ^^^^^^^ [code:1:a0af24714e]'We ask you not to use our program as it is still the test mode' Try mysqlconnection = New MySqlConnection mysqlconnection.ConnectionString = "server=************;Port=3306; User ID=**********; password=************; database=**************" mysqlconnection.Open() Catch ex As Exception MsgBox("Mogelijk heeft u geen internet. Dit is wel nodig voor dit spel probeer het later opnieuw") Me.Close() End Try Dim myadapter As New MySqlDataAdapter Dim sqlquery = "SELECT * FROM Users Where username = '" + UsernameTextBox.Text + "'" Dim myCommand As New MySqlCommand myCommand.Connection = mysqlconnection myCommand.CommandText = sqlquery myadapter.SelectCommand = myCommand Dim myData As MySqlDataReader myData = myCommand.ExecuteReader() If myData.HasRows = 0 Then Try mysqlconnection.Close() mysqlconnection.Open() Dim newadapter As New MySqlDataAdapter mysqlconnection = New MySqlConnection mysqlconnection.ConnectionString = "server=************;Port=3306; User ID=**********; password=***********; database=***************" mysqlconnection.Open() Dim SqlQuary = "INSERT INTO Users (Username, Password, Email) VALUES ('" & UsernameTextBox.Text & "','" & PasswordTextBox.Text & "','" & EMAIL.Text & "')" Dim Command As New MySqlCommand Command.Connection = mysqlconnection Command.CommandText = SqlQuary myadapter.SelectCommand = Command myData = Command.ExecuteReader MsgBox("Gebruiker aangemaakt") Catch ex As Exception MessageBox.Show(ex.Message) End Try Else MsgBox("Kon geen account aanmaken mogelijke is deze account bezet!") End If [/code:1:a0af24714e]
  • Als ik het programma start op een andere computer krijg ik een error van visual basic (ik open als exe) wat heb ik fout gedaan. Dit is de registratiesysteem [code:1:ab44cc3c78]Try mysqlconnection = New MySqlConnection mysqlconnection.ConnectionString = "server=sk.net;Port=3306; User ID=**********; password=&&&&&; database=torrentshares" mysqlconnection.Open() Catch ex As Exception MsgBox("Mogelijk heeft u geen internet. Dit is wel nodig voor dit spel probeer het later opnieuw") Me.Close() mysqlconnection.Close() End Try Dim myadapter As New MySqlDataAdapter Dim sqlquery = "SELECT * FROM Users Where username = '" + UsernameTextBox.Text + "'" Dim myCommand As New MySqlCommand myCommand.Connection = mysqlconnection myCommand.CommandText = sqlquery myadapter.SelectCommand = myCommand Dim myData As MySqlDataReader myData = myCommand.ExecuteReader() If myData.HasRows = 0 Then Try mysqlconnection.Close() mysqlconnection.Open() Dim newadapter As New MySqlDataAdapter mysqlconnection = New MySqlConnection mysqlconnection.ConnectionString = "server=free.net;Port=3306; User ID=sk; password=sk; database=torrentshares" mysqlconnection.Open() Dim SqlQuary = "INSERT INTO Users (Username, Password, Email) VALUES ('" & UsernameTextBox.Text & "','" & PasswordTextBox.Text & "','" & EMAIL.Text & "')" Dim Command As New MySqlCommand Command.Connection = mysqlconnection Command.CommandText = SqlQuary myadapter.SelectCommand = Command myData = Command.ExecuteReader MsgBox("Gebruiker aangemaakt") Catch ex As Exception MessageBox.Show(ex.Message) End Try Else MsgBox("Kon geen account aanmaken mogelijke is deze account bezet!") End If [/code:1:ab44cc3c78] En de login pagina [code:1:ab44cc3c78]Imports System.Data.SqlClient Imports MySql.Data.MySqlClient Public Class Login Dim mysqlconnection As New MySqlConnection Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Try ProgressBar1.Value = 10 mysqlconnection = New MySqlConnection mysqlconnection.ConnectionString = "server=localhost;Port=3306; User ID=root; password=loca; database=skuser" mysqlconnection.Open() Dim MyAdapter As New MySqlDataAdapter Dim SqlQuary = "SELECT * From Users WHERE Username='" & UsernameTextBox.Text & "' AND password = '" & PasswordTextBox.Text & "';" Dim Command As New MySqlCommand ProgressBar1.Value = 20 Command.Connection = mysqlconnection ProgressBar1.Value = 30 Command.CommandText = SqlQuary ProgressBar1.Value = 50 MyAdapter.SelectCommand = Command ProgressBar1.Value = 70 Dim Mydata As MySqlDataReader ProgressBar1.Value = 85 Mydata = Command.ExecuteReader ProgressBar1.Value = 100 If Mydata.HasRows = 0 Then MsgBox("Sorry you have a wrong loginname of password") ProgressBar1.Value = 0 Else Form1.Show() Me.Close() End If Catch ex As Exception MsgBox("Er heeft een fout voor gedaan de server kom geen verbinding maken") ProgressBar1.Value = 0 End Try End Sub Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click Me.Close() End Sub Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub ProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click End Sub Private Sub UsernameTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UsernameTextBox.TextChanged End Sub Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked Register.Show() Me.Close() End Sub End Class [/code:1:ab44cc3c78] Kan iemand mij helpen

Beantwoord deze vraag

Weet jij het antwoord op deze vraag? Registreer of meld je aan met je account

Dit is een gearchiveerde pagina. Antwoorden is niet meer mogelijk.