C# Tutorial 11:Database values in textbox if select Combobox
Vložit
- čas přidán 6. 04. 2013
- ★★★Top Online Courses From ProgrammingKnowledge ★★★
Python Programming Course ➡️ bit.ly/2vsuMaS ⚫️ bit.ly/2GOaeQB
Java Programming Course ➡️ bit.ly/2GEfQMf ⚫️ bit.ly/2Vvjy4a
Bash Shell Scripting Course ➡️ bit.ly/2DBVF0C ⚫️ bit.ly/2UM06vF
Linux Command Line Tutorials ➡️ bit.ly/2IXuil0 ⚫️ bit.ly/2IXukt8
C Programming Course ➡️ bit.ly/2GQCiD1 ⚫️ bit.ly/2ZGN6ej
C++ Programming Course ➡️ bit.ly/2V4oEVJ ⚫️ bit.ly/2XMvqMs
PHP Programming Course ➡️ bit.ly/2XP71WH ⚫️ bit.ly/2vs3od6
Android Development Course ➡️ bit.ly/2UHih5H ⚫️ bit.ly/2IMhVci
C# Programming Course ➡️ bit.ly/2Vr7HEl ⚫️ bit.ly/2W6RXTU
JavaFx Programming Course ➡️ bit.ly/2XMvZWA ⚫️ bit.ly/2V2CoAi
NodeJs Programming Course ➡️ bit.ly/2GPg7gA ⚫️ bit.ly/2GQYTQ2
Jenkins Course For Developers and DevOps ➡️ bit.ly/2Wd4l4W ⚫️ bit.ly/2J1B1ug
Scala Programming Tutorial Course ➡️ bit.ly/2PysyA4 ⚫️ bit.ly/2PCaVj2
Bootstrap Responsive Web Design Tutorial ➡️ bit.ly/2DFQ2yC ⚫️ bit.ly/2VoJWwH
MongoDB Tutorial Course ➡️ bit.ly/2LaCJfP ⚫️ bit.ly/2WaI7Ap
QT C++ GUI Tutorial For Beginners ➡️ bit.ly/2vwqHSZ
★★★ Online Courses to learn ★★★
Get 2 FREE Months of Unlimited Classes from skillshare - skillshare.eqcm.net/r1KEj
Data Science - bit.ly/2lD9h5L | bit.ly/2lI8wIl
Machine Learning - bit.ly/2WGGQpb | bit.ly/2GghLXX
Artificial Intelligence - bit.ly/2lYqaYx | bit.ly/2NmaPya
MERN Stack E-Degree Program - bit.ly/2kx2NFe | bit.ly/2lWj4no
DevOps E-degree - bit.ly/2k1PwUQ | bit.ly/2k8Ypfy
Data Analytics with R - bit.ly/2lBKqz8 | bit.ly/2lAjos3
AWS Certification Training - bit.ly/2kmLtTu | bit.ly/2lAkQL1
Projects in Java - bit.ly/2kzn25d | bit.ly/2lBMffs
Machine Learning With TensorFlow - bit.ly/2m1z3AF | bit.ly/2lBMhnA
Angular 8 - Complete Essential Guide - bit.ly/2lYvYRP
Kotlin Android Development Masterclass - bit.ly/2GcblsI
Learn iOS Programming Building Advance Projects - bit.ly/2kyX7ue
★★★ Follow ★★★
My Website - www.codebind.com
DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
-----------------------------------------------------------------------
how to bind combobox to textbox in C#
ComboBox and TextBox C#
How to show combo box selected value in a text box C#
selecting an item in combobox and display corresponding Populate combobox from database C#
How to get data in combobox from database?
Populating a Combobox from a Dictionary
How to fill different ComboBoxes in a DataGridView C#
code add database column to datagridview combobox C#
Populate combobox from database
How to get data in combobox from database?
Populating a Combobox from a Dictionary
How to fill different ComboBoxes in a DataGridView
code add database column to datagridview combobox
Enter values into combobox from database
Enter values into combobox from database C#
All your tutorials were very helpful. Thank you for all your videos :)
You are a beast my brother, thank you for saving my butt in the project.
Dude you're awesome, thanks for all this tutorials
Got to say Tutorials 11 and 12.. Although not exactly what I was after, taken bits from it, and it was very helpful.
One thing though, I've always been taught not to copy and paste code, strange to see someone actually doing it.
copy and pasting is fine for small snippets of code ...for speed - but you;re correct ....really a lot of the code in the example should have been placed in its own method and called where needed
he is working in MySQL database I'm in sql database if you the same this code will work for youstring sID = reader.GetString(reader.GetOrdinal("ID"));
string sname = reader.GetString(reader.GetOrdinal("name"));
string sSurname = reader.GetString(reader.GetOrdinal("surname"));
string sAge = reader.GetString(reader.GetOrdinal("age"));that works for me
Love you. Video is hard to follow, but what i needed was this, exactly.
Thanks a lot bro... that was a great help
Very Helpful. Thank You
Excellent tuto..Many thanks
excelente video tutorial me servira en mi proyecto de residencia muy buen aporte .
saludoss.. me gustan tus videos (Y)..
This is how it worked in my program:
String sEid = rdr["Eid"].ToString();
String sName = rdr["name"].ToString();
String sSurname = rdr["surname"].ToString();
String sAge = rdr["age"].ToString();
Eid_txt.Text = sEid;
Name_txt.Text = sName;
Surname_txt.Text = sSurname;
Age_txt.Text = sAge;
PS. Im using MsSql database
hello mam mssql only support int value so you should give your colum number instead of colum name
thanks
Hi,
The code that I have shared in my previous post, worked as it was for me...
Hope it helps you too.
Pinar U.S. Thanx this comment helped me a lot...........
+Pinar U.S. you are great you really solve a complex problem in this tutorial thank for this
assign index no instead of names
How the hell did you pass a string into GetString() when it requires an int variable?
Nice job!
thanks your tutorials are helpfull eventhough i am programming in vb net the libraries are the same
Thank very much!
I have 3 buttons in a form in c# which goes to the same page but how do I get the names of respective buttons saved in the sql server?
Love You Man...!
can i do this with a text box instead? where when he types a id no. all values show in the textbox
at the time 9:23 why we are not assigning directly to the textboxs instead of strings or int what ever .... as there any benefit please answer.
My problem is when I add or Save a new data (ex. new employee) it doesn't show in the combo box immediately , I have to rerun the system again for the combo box to show the new data. .please help how to show the new data immediately in the combo box?
how to do the reverse process, sir. I want to control the data of combo box in case some data is inserted into a textbox. please help
thanx bro
What about WPF comboboxes.. The SelectedIndexChange doesn't exist and the SelectedValue changes after the code behind has run.
Hy man! If you have THE SAME NAME in the database TWICE, the program will not work properly.
Look at "mark" --> it's show just the last row with the eid=7. The row with eid=2 is not saved in the combox.
Why? If anyone know how to fix this please leave a message! Thanks!
How to perform same operation in ASP.NET MVC 4 Razor ???
Please let me know if somebody knows ?
Is it posible to use only one connection? Why do you have to create a new one each time??? Tnks four your help.
thanx bro.....
thank dude
Thank you!
Very nice 👍
I am using MSSQL.In MSSQL I have used ToString in place of varchar,what should I use for Int type?please help
Hi Brother there is a worst case that which id will we get if there are two same names?
Can we type a name in combobox rather than selecting it? It will be helpful in cases where you have many names to scroll and select!
yes i agree - that's called autocomplete where matching entries appear as you type each letter of the search term
rdr.GetString("Breed").ToString(); error
i made listbox2 and i had to put where name= '"+ comboBox1.SelectedItem +"'
by the way i am using a different table to get the combobox value
when i click on another item in combobox it doesnt change the vallue in the listbox2 it stays the same value
Please tell me how to display date database to textbox when select combobox..
my COBOL professor said to me that you will never write a program, you will tailor an existing program to fit your needs.
cannot convert from 'string' to 'int' ???? plz help
You need Typecasting Like - parseInt();
Does anyone else expererince that nothing happens? nothing is shown in the combobox?
+Daniel Santelices just add .SelectedItem on the combobox you used in the query
Super
Sir,
I want my second comboBox show data according to the data selected in First comboBox.
example,
In ComboBox1, i want to select the gender like (male or female),
and according to comboBox1 selection , the comboBox2 show the name of only Male (if selected) or only Female (if selected )
plz help me.. I stuck on it in my project.
you do wrong query... look at 11:23 when you select first "mark" you should get eid=2 , but you get eid=7. column name is not unique so when you select name from edata where name="mark" you get 2 record and while loop use last record ...
ta ch zhe chenakr psmam :D
Corrected:
1)
void Fillcombo()
{
string constring = "server=localhost; user=root;database=mydb;DefaultTableCacheAge=30;charset=utf8";
string Query = "select * from mydb.towary ;";
MySqlConnection conDatabase = new MySqlConnection(constring);
MySqlCommand cmdDataBase = new MySqlCommand(Query, conDatabase);
MySqlDataReader myReader;
try
{
conDatabase.Open();
myReader = cmdDataBase.ExecuteReader();
comboTowary.Items.Clear();
//MessageBox.Show("Deleted");
while (myReader.Read())
{
string ID = myReader.GetString("idTowary");
string sName = myReader.GetString("nazwaTowaru");
comboTowary.Items.Add(ID + "_"+ sName);
}
2)
private void comboTowary_SelectedIndexChanged(object sender, EventArgs e)
{
string constring = "server=localhost; user=root;database=mydb;DefaultTableCacheAge=30;charset=utf8";
string Query = "select * from mydb.towary WHERE CONCAT_WS('_',idTowary,nazwaTowaru)='"+ comboTowary.Text + "';";
What if there are exactly two names in the database?
if there is one radio button then how to do ???????
Error cannot convert from 'string' to 'int' how can i handle it? please help
int itemId = myReader.GetInt32(myReader.GetOrdinal("ItemId"));
how to do in webpages
do this in java please
how to perform same operation in android studio? please help anyone
You have error, mark its 2, and allways is id=7
Code doesn't work, bud
kindly share the source code its imp for beginers
you heard the kid !! - yes please share the code
quality sucks AND WHY DO YOU RECORD ONLY YOUR MOUSE WHY NOT THE WHOLE SCREEN ITS SO HARD TO WATCH
Its really time wasting task to follow these examples, while they are very good to learn from. I dont understand the idea why the developer just dont leave the code written? To save us from following them for hours? and saving us from small mistakes?
I spent hours making this example, and I got "
unable to connect to any of the specified mysql hosts"
So, please next time when you do something, do it complete. and leave the code to download it