VB.Net: Filling a ComboBox with data stored in database how to bind combobox to textbox in VB.NET ComboBox and TextBox VB.NET How to show combo box …
source
VB.Net: Filling a ComboBox with data stored in database how to bind combobox to textbox in VB.NET ComboBox and TextBox VB.NET How to show combo box …
source
35 responses to “MySQL VB.NET Tutorial 9 : How to Link Combobox with Database values”
Thank You So much
Thanks, very useful videos series
Hi Everyone!
Just starting to learn VB.Net, I have gone through this lesson from start to finish, but cant seem to work out why I can't get mine to work!, I know it is different as I am using Sql not MySql, so trying to work out where I'm going wrong. At the point of …. While Reader.Read ; Dim sName = Reade.GetString("name ") I keep getting a InvalidCastException, any of you know what is going on???
Thanks
Tried this for a access database and it comes out with syntax error in FROM Clause. Any clue?
what is the data type of your 'name' sir? my combobox cannot display items i don't know why.
Thank you, but I have a question
when i try to insert date from Visual Basic Project to SQL Server 2008 with windows 7 I use '" & dateTipePiker.Text & "' it works when I use Windows 8 it don't work
I tried '" & dateTipePiker.Value & "' and '" & dateTipePiker.Value.Date & "' and still dosen't work
What should I do???
thanks.. but after linking can i do like based on enter values in combobox put the value in the text box based on what saved in database
é nois mano <3
Sir, when i run this code im getting the error as authentication to host''user'' using method'mysql close etc.
what should i do to clear this error??
Pls help
please make a tutorial on report with ms access database and mysql database
show all report types
its not working
Is there any sample code to download?
What the code would be if I'm using Visula BAsic 2008???
Thanks
user need mysql to use program ?
hey what version of mysql use for this ?
My Respect to your knowledge, very useful video, I am facing a challange in the similar arena, I have 2 tables, for ex. Customer Master and Supplier Master, the task is to populate Cust_Name field value and Supp_Name field value in single combo box… is it possible and how do I achieve this…? Many thanks in advance
Thanks Al lot mate ! great tutorial
Thank you very match , great tutorial !
Just in case anyone has trouble with Dim sName = Reader.GetString("name") then it is because your datatype in SQL server is not defined as a string. In my case it was varchar(50) so I changed the code to:
Dim sName = Reader.GetString(0)
0 = first column
1 = second column
2 = third column
and so on.
now it works.
Conversion from string "PROP_Username" to type 'Integer' is not valid.
I get this error on most of your tutorials and i don't know how to fix.
It occurs on this code:
Dim sName = READER.GetString("PROP_Username")
SearchSQL.Items.Add(sName)
Hi, thanks for the programming tutorials, i have different tables in mysql database and would like to get the data from this tables to the same form in vb.net but on different combo boxes, kindly assist me with the solution. thanks in advance.
i.e. i have a table that has patients details and another with doctors details, now i would love to get the patient ID and doctor ID in one form then save to another table e.g an admission table
What, if i hav more Comboboxes? Can't get my code working!
Thanks!
thanks for this video series. it has been very helpful to me.
okay guys to those who has problems with conversion error in getstring use this code
dim "name of the value" = "name of the datareader".getstring(column number)
dim sname = reader.getstring(2) // column 2 or name
what if i want to filter the datagridview using that combobox, it's that possible???
THANK YOU!
how can i populate my combo box when i need to get the value from 2 tables?
Hi,
thanks for your video. It works fine, but I have a problem. All item are dobble in the list, exakt 2 times.
Dim cn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim dr As MySqlDataReader
cn.ConnectionString = "server = 192.168.2.50; user id = *; password = *; database = *"
cmd.Connection = cn
Try
cn.Open()
cmd.CommandText = "SELECT Nr, Name FROM goae Order by Nr;"
dr = cmd.ExecuteReader
While dr.Read
Dim Teil = dr.GetString("Nr")
cbb_go1.Items.Add(Teil)
End While
dr.Close()
Catch ex As Exception
MessageBox.Show(ex.Message, "SQL-Fehler4", MessageBoxButtons.OKCancel, MessageBoxIcon.Error)
Finally
cn.Dispose()
End Try
cn.Close()
End Sub
It is start by 1 and go to 100 and begin a secound time by 1 and end by 100.
Why ?
Can you help me.
Thanks
Congrats for your videos series…the best found so far and you are the only one who explains exactly what you have in the descriptions…UNLIKELY SOME OTHER STUPIDS WHO just want to show themselves and in order to explain how much is 1+1 it takes them 10 mnutes of video!!!
Getting Error 🙁 conversion from string …. t0 type integer is not valid :'(
hello. thanks for your video, nicely explained.
but unfortunately, when i follow the code, this gives me error that "conversion from type string to integer is not valid"
as i am trying to fetch the values from my database that are in the form varchar, and that GetString("tablename")
where getString will fetch the data to integer as it shows in the VB IDE, so can you suggest another way around??
help will be appreciated.
NOTE: my backend is MS SQL server 2012
Can you select an Item in your combobox and have it display the primary key in the database associated with the value in the combobox.text ?
i still can fill the data into combo box…here the code…i hope u can check it..
Imports MySql.Data.MySqlClient
Imports System.Data.SqlClient
Imports System.Windows.Forms
Public Class Form10
Dim con As MySqlConnection
Dim cmd As New MySqlCommand
Dim query As String
Dim da As New MySqlDataAdapter
Private Sub Form10_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = ("server=Server=localhost;Database=einventorysystem;Uid=eisystem;password=password")
Dim re As MySqlDataReader
Try
con.Open()
query = "select * from einventorysystem.inventory"
cmd = New MySqlCommand(query, con)
re = cmd.ExecuteReader
While re.Read
Dim iName = re.GetString("iname")
ComboBox1.Items.Add(iName)
End While
con.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
con.Dispose()
End Try
End Sub
End Class