C# Tutorial 10: How to Link Combobox with Database values

Поділитися
Вставка
  • Опубліковано 19 гру 2024

КОМЕНТАРІ •

  • @pinar2213
    @pinar2213 11 років тому +34

    This is how it worked in my case:
    SqlDataReader rdr = command.ExecuteReader();
    while (rdr.Read())
    {
    String sName = rdr["Name"].ToString();
    comboBox1.Items.Add(sName);
    }
    PS. am using MsSql database, but the way it was explained did not work for me.
    * still appreciated for the tutorials!

  • @blickCharizard
    @blickCharizard 11 років тому +1

    Thank you this really helped me. I was using access instead of sql so was stuck a bit but worked it out. For those using access instead of string sName = myReader.GetString("name"); its should be string sName = myReader["Name"].ToString(); and of course for the connection it should be "OleDb" in places where it says "MySql".

    • @mannylines2198
      @mannylines2198 5 років тому +1

      Superstar! I'm using SQL and not Access and this worked for me.
      Cheers!

    • @sifatislam8693
      @sifatislam8693 5 років тому

      thank you for this help😍👌

  • @dimpaldimpal1674
    @dimpaldimpal1674 5 років тому

    im doing my whole assignment from your videos only....this videos are helping me a lot.... thank you so much.... the way you explain is just awesome.....thank you so much..

  • @hamedjabarian1155
    @hamedjabarian1155 9 років тому +3

    you are very great tutor and your teaching actually solved my headache, the only and sole critique would be shaking mouse during talking and I am sure you will appreciate this notice for future videos.

    • @leosilva0411
      @leosilva0411 9 років тому

      +Hamed Jabarian This takes out my attention too

    • @ghussain7096
      @ghussain7096 7 років тому +1

      any one can tell me how to get a values in comboBox through database table

  • @fahim6191
    @fahim6191 8 років тому +1

    You are the Google of programmers. I really really appreciate you for being such a good teacher.

  • @madhushaniguruge5212
    @madhushaniguruge5212 2 роки тому

    I'll share this with my college friend ❤️ Thank you for the well explanation 👌

  • @tinytutor413
    @tinytutor413 9 років тому +1

    Sir how can we add eid behind name in comboBox using wpf

  • @amitgawade4184
    @amitgawade4184 9 років тому +5

    Error 1 The best overloaded method match for 'System.Data.Common.DbDataReader.GetString(int)' has some invalid arguments
    Error 2 Argument 1: cannot convert from 'string' to 'int'
    Error in GetString();

    • @Zenit0244
      @Zenit0244 9 років тому

      then how about the int, how can i change that to int?

    • @leosilva0411
      @leosilva0411 9 років тому +1

      +Jemuel Ortega Convert.ToInt32(STRING);
      Try to always convert to "Int32" because it's the default.
      I think it's right what im saying, but of course search more, but try this that i i said.

    • @sibghatullah4609
      @sibghatullah4609 8 років тому +4

      +Amit Gawade Enter the Number of Column in which the data is present :), i was stuck too but it was pretty easy, for catching string value write reader.getString(1); , and for Integer value write reader.getInt32(1);

    • @suponjibobu6871
      @suponjibobu6871 8 років тому

      +Sibghat Ullah thank you dude.. that worked for me..

    • @pfeo1997
      @pfeo1997 8 років тому

      Thanks man! Had the same problem :/

  • @e-piggy8635
    @e-piggy8635 10 років тому +4

    If suppose i want to take ID instead of name in combobox then how should i convert dat int??
    plzz help

  • @lebogangkgomo4006
    @lebogangkgomo4006 10 років тому

    very useful.You made it very easier for me to understand it.

  • @TheUrzur
    @TheUrzur 9 років тому

    excelent tutorial, easy to understand. exactly what I was looking for, thank you.

  • @prashantpal2678
    @prashantpal2678 9 років тому +4

    Error .!! in GetString(); plzz help .. its show " get the value of specified column as a string " ... HELP .!!!

    • @sibghatullah4609
      @sibghatullah4609 8 років тому

      +Prashant Pal Specify column like getstring(1); :)

  • @43saywhat23
    @43saywhat23 10 років тому

    Thanks a lot for your videos. You are a really good tutor.

  • @alyalsalem
    @alyalsalem 11 років тому

    Many thanks for your great efforts,
    I need your help to print the data the data using print-table.
    Thanks again.

  • @damirsvegovic716
    @damirsvegovic716 10 років тому +2

    do you have link with code for your examples ? THX

  • @aal2002
    @aal2002 2 роки тому

    THANK YOU!!!! Where do I send the check? :)

  • @erikasong3054
    @erikasong3054 7 років тому

    a massive thank you for uploading this very useful tutorials! GOD blesd you! :)

  • @peanutbutterx5534
    @peanutbutterx5534 3 роки тому

    I have an issue where the items do load into the combobox so when i use the drop down box all items appear but for some reason when i select them they don't load into the box, like I can click them on the list but nothing happens when i do

  • @tanjimashraf803
    @tanjimashraf803 5 років тому

    if I want to show the first 3 names (Or just a single specific name) inside the combo box, how can I do that?

    • @stano.marochok
      @stano.marochok 5 років тому

      I am not sure that it will certainly help you, but you can use "limit" property of SQL query (www.geeksforgeeks.org/sql-limit-clause/) to get the first 3 names, and you can use "where" to get some specific name (for example, select name from users where name = 'Marko').
      Hope it will help you!

  • @RheanneGequillana
    @RheanneGequillana 10 років тому

    Is it possible to have a two C# codes in Search button? If you have any idea for this, please let me know. Please reply. Thanks. :)

  • @xsoldier2222
    @xsoldier2222 6 років тому

    I don't have to stop the connection somewhere? I mean you did conDataBase.Open() but I don't see in your code that you actually used conDataBase.Close() and if is not necesary please explain and thanks!

  • @kristofkovacs7621
    @kristofkovacs7621 7 років тому

    How can you add the combobox the name of the column? I need to be able to search in my database and i want it to be like this: Search by (combobox) and then a textbox to write the data we are searching in the database and then a search button. I hope you understand how i want to do it.

  • @kavinduful
    @kavinduful 10 років тому +1

    I really like your videos. Please advise me to populate data from Oracle Database

  • @vishaltayal6801
    @vishaltayal6801 8 років тому

    sir weather it is possible to input only restricted data entry in a column
    such as suppose in column b1:b1000 I wanna input only a.b.c.d and also zero how can I
    now any data entry user not fill f.g.h or any word or numaric

  • @reda962able
    @reda962able 5 років тому

    I llike the way you explain

  • @malvin18
    @malvin18 11 років тому

    hi! thanks for your tutorial, I really learned a lot. How can i make my combobox has a distinct content when I retrieved the data from my database? thanks again.

  • @goatdean12
    @goatdean12 11 років тому

    have you tried putting distinct on the SQL query?

  • @rogerbreton6412
    @rogerbreton6412 4 роки тому

    Thank you for loading the ComboBox; how about Add, Remove, Modify?

  • @mohamedhussein9679
    @mohamedhussein9679 3 роки тому

    Excellent! helped a lot

  • @littlemarc2011
    @littlemarc2011 9 років тому +5

    Does no one see the the person "Max" is missing...

  • @MrDaBo94
    @MrDaBo94 10 років тому

    You're pretty good, thank you.

  • @FernandoBelloDeveloper
    @FernandoBelloDeveloper 4 роки тому

    can I put together into the combobox the name and the surname? How can I do that?

  • @tarapos
    @tarapos 11 років тому

    Are you available for consulting?

  • @kanzayahya3775
    @kanzayahya3775 8 років тому

    Error 2 The best overloaded method match for 'System.Data.Common.DbDataReader.GetString(int)' has some invalid arguments
    i m getting this error what should i do :(

  • @draganatosovic7541
    @draganatosovic7541 5 років тому

    Does anyone know how to link combobox to combobox so it can affect the choice? For example, if I select 1 manufacturer in combobox 1, I need to get only his products in combobox 2.
    I'm using C# and MSSQL :)

  • @asendrakushwaha2940
    @asendrakushwaha2940 10 років тому

    very Usefull context

  • @samindirathnayake99
    @samindirathnayake99 3 роки тому

    Thank you so much 💕

  • @SuvasishChowdhuryBONO
    @SuvasishChowdhuryBONO 8 років тому

    Excellent.... Keep it up (y)...

  • @banda20549
    @banda20549 10 років тому

    thnx man ,great help !!!!!!!! gud luck

  • @mouhanedbenali8583
    @mouhanedbenali8583 9 років тому

    hello can you help me please! i have to an application wich are web browser for handicaped so i can move mouse with your head and eyes if you interrested to help me just tell me so i can explain it better for you

  • @lahirurathnaweera6799
    @lahirurathnaweera6799 10 років тому

    thnks this is really great work man!!!

  • @tivy1960
    @tivy1960 11 років тому

    I need your help extracting data from an Access database. I'm sure a lot of the coding is the same but I know if all will not work. Please advise...

  • @erkancankurt4327
    @erkancankurt4327 8 років тому

    hi , thanks a lot your helpful lesson.I did and It works but I need to know one more thing about it that how we can do that if we have more combobox selections.I mean that a textbox will show the data after we choose two different combobox elements .I applied below code but it doesn't work.please help me about this problem.
    cmd.CommandText = "SELECT * FROM table1 WHERE name = '" + comboBox2.Text + "' and surname ='" + comboBox3.Text + "

  • @SunShine24024
    @SunShine24024 4 роки тому

    Very good

  • @reda962able
    @reda962able 5 років тому

    dont Forget to add the Using for SQL

  • @senalisiriwardhana9216
    @senalisiriwardhana9216 3 роки тому

    Thank You

  • @CarvalhoFrederico
    @CarvalhoFrederico 10 років тому

    You are the best man!!! Love you!!! :D

  • @natonatox3719
    @natonatox3719 7 років тому

    gracias hermano, me salvaste,

  • @hamed2011
    @hamed2011 9 років тому

    i use this but problem column not filled in combobox
    SqlConnection probcon = new SqlConnection("Data Source=.;Initial Catalog=db3;Integrated Security=True");
    conn.Open();
    SqlCommand probcmd = new SqlCommand("select problem from phone where number=@number", probcon); //number column
    probcmd.Parameters.AddWithValue("@number", label1.Text); //c# source
    SqlDataReader DR = probcmd.ExecuteReader();
    while (DR.Read())
    {
    lastproblem.Items.Add(DR[0]);
    }

  • @ummefatema932
    @ummefatema932 3 роки тому

    in there 'mark' have 2 times, but i need show 'mark' only one time, plz help me

  • @MrSaghgha
    @MrSaghgha 9 років тому +2

    I think when you are explaining in your tutorials, it is not necessary to shake your mouse anymore .... Attention Please.

    • @gcxs
      @gcxs 9 років тому +1

      MrSaghgha that's a natural gesture hahahaha

  • @popsd8697
    @popsd8697 6 років тому

    Thnaks bro

  • @VikumCharukaEgodapitiya
    @VikumCharukaEgodapitiya 9 років тому

    how do we use the combo box with a database while using oop concepts!!!SOS please some one tell me

  • @yumareynare8012
    @yumareynare8012 6 років тому

    Thank you!

  • @Galfonz
    @Galfonz 9 років тому

    Your example is missing the last name in the table. You aren't seeing all the names.

  • @gedeom10
    @gedeom10 7 років тому

    What if there are exactly two names in the database?

  • @fkaratay
    @fkaratay 10 років тому +1

    I found the context is very useful. However I don't understand that why you are drawing circle with the cursor over and over again during the video. It's annoying. Stop doing that man!

    • @Teraprinny
      @Teraprinny 9 років тому

      It's probably, because of the software he used to record his video.

  • @danm2092
    @danm2092 10 років тому +2

    Didn't finish the video because I got so annoyed with you moving the mouse around in circles -_-

  • @ravindutharumal1720
    @ravindutharumal1720 6 років тому

    Thanks Bro!!!!!

  • @Gyhach
    @Gyhach 11 років тому

    merci bcp

  • @tahirmahmoodhashmi7418
    @tahirmahmoodhashmi7418 8 років тому

    You name is nadeem?

  • @MrBeavis2014
    @MrBeavis2014 11 років тому

    thx

  • @ghussain7096
    @ghussain7096 7 років тому

    this is how it worked in sql server ????

  • @jasony4315
    @jasony4315 6 років тому

    shaking the mouse like crap, i got dizzy!

  • @HGAMES69
    @HGAMES69 3 роки тому

    1.5x speed. You're welcome

  • @tivy1960
    @tivy1960 11 років тому

    Or, if anyone else can help, please reply....

  • @elfutitooo
    @elfutitooo 9 років тому

    C

  • @deepikajain3602
    @deepikajain3602 6 років тому

    hi.very nicely explain.i want to ask one query regarding my project please can u give me your mail id

  • @muhammadsafiullah8428
    @muhammadsafiullah8428 5 років тому

    Play it in 1000x speed.

  • @uglevod184
    @uglevod184 7 років тому

    кривой уродский способ снимать экран

  • @rehemaawadhi1481
    @rehemaawadhi1481 2 роки тому

    Thank you so much

  • @aithrajuniabouty599
    @aithrajuniabouty599 5 років тому

    THANK YOU SO MUCH