C# Tutorial 11:Database values in textbox if select Combobox

Sdílet
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#

Komentáře • 70

  • @matsuabiabiabi
    @matsuabiabiabi Před 10 lety

    All your tutorials were very helpful. Thank you for all your videos :)

  • @logicfirst7959
    @logicfirst7959 Před 8 lety +1

    You are a beast my brother, thank you for saving my butt in the project.

  • @jmgcloquendero
    @jmgcloquendero Před 7 lety

    Dude you're awesome, thanks for all this tutorials

  • @Alphalos10
    @Alphalos10 Před 11 lety +1

    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.

    • @dmm10000
      @dmm10000 Před 6 lety

      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

  • @gian-lucanardini9706
    @gian-lucanardini9706 Před 8 lety +8

    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

  • @ravikantha1
    @ravikantha1 Před 5 lety

    Very Helpful. Thank You

  • @TheShakalab
    @TheShakalab Před 11 lety

    Excellent tuto..Many thanks

  • @orlanncruz6447
    @orlanncruz6447 Před 7 lety

    excelente video tutorial me servira en mi proyecto de residencia muy buen aporte .
    saludoss.. me gustan tus videos (Y)..

  • @pinar2213
    @pinar2213 Před 10 lety +12

    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

    • @murugans5287
      @murugans5287 Před 10 lety

      hello mam mssql only support int value so you should give your colum number instead of colum name
      thanks

    • @pinar2213
      @pinar2213 Před 10 lety

      Hi,
      The code that I have shared in my previous post, worked as it was for me...
      Hope it helps you too.

    • @sandeepnair5482
      @sandeepnair5482 Před 9 lety

      Pinar U.S. Thanx this comment helped me a lot...........

    • @travelwithnaeemhasan
      @travelwithnaeemhasan Před 8 lety

      +Pinar U.S. you are great you really solve a complex problem in this tutorial thank for this

    • @hidayaturrahman7897
      @hidayaturrahman7897 Před 7 lety

      assign index no instead of names

  • @grady730
    @grady730 Před 4 lety +3

    How the hell did you pass a string into GetString() when it requires an int variable?

  • @djragner
    @djragner Před 9 lety +1

    Nice job!

  • @suconnottu64
    @suconnottu64 Před 8 lety

    thanks your tutorials are helpfull eventhough i am programming in vb net the libraries are the same

  • @jacksonbr4759
    @jacksonbr4759 Před 7 lety

    Thank very much!

  • @NVNRAI
    @NVNRAI Před 5 lety

    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?

  • @bhoir89
    @bhoir89 Před 6 lety

    Love You Man...!

  • @cheetah7170
    @cheetah7170 Před 7 lety

    can i do this with a text box instead? where when he types a id no. all values show in the textbox

  • @hidayaturrahman7897
    @hidayaturrahman7897 Před 7 lety

    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.

  • @JunLee000
    @JunLee000 Před 8 lety

    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?

  • @subhamsamir9209
    @subhamsamir9209 Před 6 lety

    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

  • @hirucool1
    @hirucool1 Před 10 lety

    thanx bro

  • @ChristosG
    @ChristosG Před 6 lety

    What about WPF comboboxes.. The SelectedIndexChange doesn't exist and the SelectedValue changes after the code behind has run.

  • @Alexander1stable
    @Alexander1stable Před 10 lety

    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!

  • @himanshukhare1992
    @himanshukhare1992 Před 8 lety +2

    How to perform same operation in ASP.NET MVC 4 Razor ???
    Please let me know if somebody knows ?

  • @juancarlosfarias3173
    @juancarlosfarias3173 Před 10 lety

    Is it posible to use only one connection? Why do you have to create a new one each time??? Tnks four your help.

  • @kaivalyajamkhindi3770
    @kaivalyajamkhindi3770 Před 10 lety

    thanx bro.....

  • @GiancarloCarccamo
    @GiancarloCarccamo Před 11 lety

    thank dude

  •  Před 2 lety

    Thank you!

  • @SunShine24024
    @SunShine24024 Před 3 lety

    Very nice 👍

  • @foodcraver765
    @foodcraver765 Před 11 lety

    I am using MSSQL.In MSSQL I have used ToString in place of varchar,what should I use for Int type?please help

  • @evilgogeta4
    @evilgogeta4 Před 4 lety

    Hi Brother there is a worst case that which id will we get if there are two same names?

  • @nishantvivek725
    @nishantvivek725 Před 7 lety +1

    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!

    • @dmm10000
      @dmm10000 Před 6 lety

      yes i agree - that's called autocomplete where matching entries appear as you type each letter of the search term

  • @gajendran8439
    @gajendran8439 Před 5 lety +4

    rdr.GetString("Breed").ToString(); error

  • @cabalsdemon
    @cabalsdemon Před 9 lety

    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

  • @muruligowda2985
    @muruligowda2985 Před 6 lety

    Please tell me how to display date database to textbox when select combobox..

  • @dangerleyba
    @dangerleyba Před 11 lety

    my COBOL professor said to me that you will never write a program, you will tailor an existing program to fit your needs.

  • @sabeenmalik7582
    @sabeenmalik7582 Před 6 lety +3

    cannot convert from 'string' to 'int' ???? plz help

  • @santelices1
    @santelices1 Před 9 lety +3

    Does anyone else expererince that nothing happens? nothing is shown in the combobox?

    • @20sieghart
      @20sieghart Před 8 lety

      +Daniel Santelices just add .SelectedItem on the combobox you used in the query

  • @tcgamingyt6528
    @tcgamingyt6528 Před 3 lety

    Super

  • @rajatkumargupta2483
    @rajatkumargupta2483 Před 7 lety

    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 )

  • @SCSC324
    @SCSC324 Před 10 lety

    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 ...

  • @aryan1997able
    @aryan1997able Před 7 lety

    ta ch zhe chenakr psmam :D

  • @astronom201
    @astronom201 Před 9 lety

    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 + "';";

  • @gedeom10
    @gedeom10 Před 7 lety

    What if there are exactly two names in the database?

  • @siddharthasharma3866
    @siddharthasharma3866 Před 8 lety

    if there is one radio button then how to do ???????

  • @travelwithnaeemhasan
    @travelwithnaeemhasan Před 8 lety

    Error cannot convert from 'string' to 'int' how can i handle it? please help

  • @RankOoze
    @RankOoze Před 7 lety

    how to do in webpages

  • @bouhlalabdessamad5366
    @bouhlalabdessamad5366 Před 7 lety

    do this in java please

  • @nameersummitsolution1799

    how to perform same operation in android studio? please help anyone

  • @astronom201
    @astronom201 Před 9 lety

    You have error, mark its 2, and allways is id=7

  • @brandoncox469
    @brandoncox469 Před 4 lety

    Code doesn't work, bud

  • @farhanzahid9785
    @farhanzahid9785 Před 7 lety

    kindly share the source code its imp for beginers

    • @dmm10000
      @dmm10000 Před 6 lety

      you heard the kid !! - yes please share the code

  • @fbibad2262
    @fbibad2262 Před 5 lety

    quality sucks AND WHY DO YOU RECORD ONLY YOUR MOUSE WHY NOT THE WHOLE SCREEN ITS SO HARD TO WATCH

  • @MicrosiMe
    @MicrosiMe Před 7 lety

    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