Two colomn data bind to one combo box.
-
Dear All, I have Table(MS SQL Sever 2000) name "Item" It has two colomn "ItemNo, IName") and it has relevant sample data also. Actually I can bind one colomn data to combo box(Using data set). But I need bind this two colomn("ItemNo", "IName") data in one combo box. Pls, tell me or send sample code for that. I'll think after binding two colomn like this. 00001 - Mother Board 00002 - Mouse 00003 - Key Board. Thanks & Regrds Kusal
-
Dear All, I have Table(MS SQL Sever 2000) name "Item" It has two colomn "ItemNo, IName") and it has relevant sample data also. Actually I can bind one colomn data to combo box(Using data set). But I need bind this two colomn("ItemNo", "IName") data in one combo box. Pls, tell me or send sample code for that. I'll think after binding two colomn like this. 00001 - Mother Board 00002 - Mouse 00003 - Key Board. Thanks & Regrds Kusal
You'll need to build a collection of strings that combines the values and bind to that.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
You'll need to build a collection of strings that combines the values and bind to that.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Dear All, I have Table(MS SQL Sever 2000) name "Item" It has two colomn "ItemNo, IName") and it has relevant sample data also. Actually I can bind one colomn data to combo box(Using data set). But I need bind this two colomn("ItemNo", "IName") data in one combo box. Pls, tell me or send sample code for that. I'll think after binding two colomn like this. 00001 - Mother Board 00002 - Mouse 00003 - Key Board. Thanks & Regrds Kusal
before doing collection of string tell me schould u want to make both in display othervice set data member as one field and value member as other field so it will consider the the value member if u selected the data member i think i am saying in reverse any how it will give u a good result
with regards Balagurunathan.B
-
Dear All, I have Table(MS SQL Sever 2000) name "Item" It has two colomn "ItemNo, IName") and it has relevant sample data also. Actually I can bind one colomn data to combo box(Using data set). But I need bind this two colomn("ItemNo", "IName") data in one combo box. Pls, tell me or send sample code for that. I'll think after binding two colomn like this. 00001 - Mother Board 00002 - Mouse 00003 - Key Board. Thanks & Regrds Kusal
Personally I would combine them in your query alone with the original 2 kept separate. So you would so something like the following.
SELECT (ItemNo + ' - ' + IName) AS CombinedColumns
That way it is taken care of and you dont have to do any extra work in your code.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy)
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School) -
Dear All, I have Table(MS SQL Sever 2000) name "Item" It has two colomn "ItemNo, IName") and it has relevant sample data also. Actually I can bind one colomn data to combo box(Using data set). But I need bind this two colomn("ItemNo", "IName") data in one combo box. Pls, tell me or send sample code for that. I'll think after binding two colomn like this. 00001 - Mother Board 00002 - Mouse 00003 - Key Board. Thanks & Regrds Kusal
I would suggest that you construct SQL statement that concatenates the two column some thing like the following Select (Col1 + ' - ' + Col2) as Col1, Col3 from Table Once you do this you can always bind the col1 to dataText and col3 to datavalue Hope that sounds good to you.
Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com