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!
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".
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..
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.
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();
+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.
+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);
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
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!
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!
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.
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
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.
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 :(
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 :)
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
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 + "
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]); }
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!
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!
Life Saver!!
this isn't working please help
i love u
Same here! Thank you!
Yes.. this work for me .
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".
Superstar! I'm using SQL and not Access and this worked for me.
Cheers!
thank you for this help😍👌
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..
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.
+Hamed Jabarian This takes out my attention too
any one can tell me how to get a values in comboBox through database table
You are the Google of programmers. I really really appreciate you for being such a good teacher.
I'll share this with my college friend ❤️ Thank you for the well explanation 👌
Sir how can we add eid behind name in comboBox using wpf
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();
then how about the int, how can i change that to int?
+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.
+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);
+Sibghat Ullah thank you dude.. that worked for me..
Thanks man! Had the same problem :/
If suppose i want to take ID instead of name in combobox then how should i convert dat int??
plzz help
I hv d sm prob.. Any solution?
very useful.You made it very easier for me to understand it.
excelent tutorial, easy to understand. exactly what I was looking for, thank you.
Error .!! in GetString(); plzz help .. its show " get the value of specified column as a string " ... HELP .!!!
+Prashant Pal Specify column like getstring(1); :)
Thanks a lot for your videos. You are a really good tutor.
Many thanks for your great efforts,
I need your help to print the data the data using print-table.
Thanks again.
do you have link with code for your examples ? THX
THANK YOU!!!! Where do I send the check? :)
a massive thank you for uploading this very useful tutorials! GOD blesd you! :)
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
if I want to show the first 3 names (Or just a single specific name) inside the combo box, how can I do that?
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!
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. :)
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!
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.
I really like your videos. Please advise me to populate data from Oracle Database
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
I llike the way you explain
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.
have you tried putting distinct on the SQL query?
Thank you for loading the ComboBox; how about Add, Remove, Modify?
Excellent! helped a lot
Does no one see the the person "Max" is missing...
You're pretty good, thank you.
can I put together into the combobox the name and the surname? How can I do that?
Are you available for consulting?
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 :(
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 :)
very Usefull context
Thank you so much 💕
Excellent.... Keep it up (y)...
thnx man ,great help !!!!!!!! gud luck
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
thnks this is really great work man!!!
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...
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 + "
Very good
dont Forget to add the Using for SQL
Thank You
You are the best man!!! Love you!!! :D
gracias hermano, me salvaste,
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]);
}
in there 'mark' have 2 times, but i need show 'mark' only one time, plz help me
I think when you are explaining in your tutorials, it is not necessary to shake your mouse anymore .... Attention Please.
MrSaghgha that's a natural gesture hahahaha
Thnaks bro
how do we use the combo box with a database while using oop concepts!!!SOS please some one tell me
Thank you!
Your example is missing the last name in the table. You aren't seeing all the names.
What if there are exactly two names in the database?
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!
It's probably, because of the software he used to record his video.
Didn't finish the video because I got so annoyed with you moving the mouse around in circles -_-
That's so true!!!
Thanks Bro!!!!!
merci bcp
You name is nadeem?
thx
this is how it worked in sql server ????
shaking the mouse like crap, i got dizzy!
1.5x speed. You're welcome
Or, if anyone else can help, please reply....
C
hi.very nicely explain.i want to ask one query regarding my project please can u give me your mail id
Play it in 1000x speed.
кривой уродский способ снимать экран
Thank you so much
THANK YOU SO MUCH