MySQL Forums
Forum List  »  Connector/ODBC

Pb Integer Select Mysql VB 2015
Posted by: PokeMan One
Date: May 21, 2017 02:47PM


I'm new to MySql databases and using it with VB:

I've been surching on the net for days, and all I found is questions like mine with no suggestions that seems to work for anyone... so I'm asking again...

If I initialize Key1 = 1 delcared as integer (or int32, int16, ...) the select doesn't find anything in the table. The Pgr do not go into the loop that fills the object, but if I put Menu_Id = 1" in the query it works...

I'm trying to retrieve data from a table that has a key declared as an Integer (or any other type of integer, I've tried them all) and the select doesn't find any row. But if I put the value 1 in the select clause, it works! here is the code: (I'm new to VB with SQL querys, so trie to explain in detail, if I may ask.)

Imports MySql.Data.Entity
Imports MySql.Data.MySqlClient
Imports MySql.Data.Types

Public Class Form1
Dim Connexion As String = "Server=localhost;Database=Project_Inca;Uid=root; password=test;"

' Public ile As String
Public Function connecter()
Dim conn As MySqlConnection = New MySqlConnection
conn.ConnectionString = Connexion
Return conn
End Function

Private Sub Fonds_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim lecteur As MySqlDataReader
Dim Requete As String
Dim key1 As Integer = 1
Requete = "select Tool_Id, Tool_Mn_1 from Menu_tools where Tool_Id = key1"
Dim Commande As New MySqlCommand(Requete, connecter)
lecteur = Commande.ExecuteReader
Do While lecteur.Read
End Sub
End Class

Options: ReplyQuote

Written By
Pb Integer Select Mysql VB 2015
May 21, 2017 02:47PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.