comboBox woes
-
Hey all, got an issues thats been stumping me for a few days now, and instead of coming to you guys first (like i knew i should have) i've wasted about 3-4 days worth of good time, beating my head against the wall on this issue.....!!! Using postgres database, PgSqlClient ADO.Net Data Provider, and VS'03. I'm having a problem populating a comboBox with data from Postgres...well rather i'm having problems getting the value member to co-operate... I've got a "users" table set up with 3 columns, well 4(oid), user_id -serial-&(pk), user_fname -text-, and user_email -text-. Database is pre-existant, so we can't change anything on it. The user table is refrenced by nearly every other table in the db, and I'm trying to ref it in the "calls" table. The comboBox comes into play when I have the operator entering the callers info into a textbox then selecting the users name (call recieved by...."user_fname") from the comboBox... I can populate it nice and pretty, just like I want, until the operator selects a name and it(comboBox) writes the valuemember of the comboBox, not the database to the table. So comboBox1.valueMember = "user_id"; says that "user_fname"(DisplayMember) Carlton should be ref at the db to serial 19, but since it is 4th on the list(not alphabetical,rather sorted by the db as a select...from....where user_email = support@blah.com) so it writes to the db as user_id 4 which obviously translates to someone else...which is really, really screwing up my call log...! now, i've tried just about everything i can think of to fix this...and i'm sure it something simple i've missed...i'm okay with that! but i've tried: dataReaders, and a while datareader(reads) { comboBox1.Items.Add(dataReader.getValue(0)) } dataAdapters, adapter1.Fill(dSet1,"users"); comboBox1.DataSource=dSet1.Tables["users"]; comboBox1.DisplayMember="user_fname"; comboBox1.ValueMember="user_id"; i've tried an array, but forgot what i did(late, late night, too many beers) and so far nothing has worked to give me the proper valuemember i need to the database refrence. Please Help!!! Oh, and please note that the code samples above were NOT the copy/paste from my real work, so don't say thats its cause i didn't capitolize or spell correctly something....lol..... Dim Beautiful As String Beautiful = "ignorant" Label1.Text = "The world is full of " & Beautiful & " people." Why is common sense such an un-common comodity?
-
Hey all, got an issues thats been stumping me for a few days now, and instead of coming to you guys first (like i knew i should have) i've wasted about 3-4 days worth of good time, beating my head against the wall on this issue.....!!! Using postgres database, PgSqlClient ADO.Net Data Provider, and VS'03. I'm having a problem populating a comboBox with data from Postgres...well rather i'm having problems getting the value member to co-operate... I've got a "users" table set up with 3 columns, well 4(oid), user_id -serial-&(pk), user_fname -text-, and user_email -text-. Database is pre-existant, so we can't change anything on it. The user table is refrenced by nearly every other table in the db, and I'm trying to ref it in the "calls" table. The comboBox comes into play when I have the operator entering the callers info into a textbox then selecting the users name (call recieved by...."user_fname") from the comboBox... I can populate it nice and pretty, just like I want, until the operator selects a name and it(comboBox) writes the valuemember of the comboBox, not the database to the table. So comboBox1.valueMember = "user_id"; says that "user_fname"(DisplayMember) Carlton should be ref at the db to serial 19, but since it is 4th on the list(not alphabetical,rather sorted by the db as a select...from....where user_email = support@blah.com) so it writes to the db as user_id 4 which obviously translates to someone else...which is really, really screwing up my call log...! now, i've tried just about everything i can think of to fix this...and i'm sure it something simple i've missed...i'm okay with that! but i've tried: dataReaders, and a while datareader(reads) { comboBox1.Items.Add(dataReader.getValue(0)) } dataAdapters, adapter1.Fill(dSet1,"users"); comboBox1.DataSource=dSet1.Tables["users"]; comboBox1.DisplayMember="user_fname"; comboBox1.ValueMember="user_id"; i've tried an array, but forgot what i did(late, late night, too many beers) and so far nothing has worked to give me the proper valuemember i need to the database refrence. Please Help!!! Oh, and please note that the code samples above were NOT the copy/paste from my real work, so don't say thats its cause i didn't capitolize or spell correctly something....lol..... Dim Beautiful As String Beautiful = "ignorant" Label1.Text = "The world is full of " & Beautiful & " people." Why is common sense such an un-common comodity?
Ok, so it seems that i was all the time looking in the wrong dirrection...it wasn't my comboBox population that was failing..it was the insert to the db that was causing the issue...i in my haste set a parameter up that looked to the selected ITEM, not the selected Value... Correction made, Have a nice night. Dim Beautiful As String Beautiful = "ignorant" Label1.Text = "The world is full of " & Beautiful & " people." Why is common sense such an un-common comodity?