cancel
Showing results for 
Search instead for 
Did you mean: 

Binding Data From the Data Base in Combo Box

Former Member
0 Kudos

Hi

All tel me how can add data in a combo box using

the data base (SQL SERVER2000)plz. help me.

Thanks & Regards

Shahid

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

To bring this a level further: is it possible to bind the ComboBox's ValidValues to a datasource?

This is a common use case: my bound form has a foreign key - so the combobox should offer a choice of the primary keys in the linked table.

Former Member
0 Kudos

<i>To bring this a level further: is it possible to bind the ComboBox's ValidValues to a datasource?

This is a common use case: my bound form has a foreign key - so the combobox should offer a choice of the primary keys in the linked table.</i>

any solution to this issue????, I get "Valid Value doesn't exist" after adding the valid value, but the valid value appears, if I add a try catch code block after adding the valid value, I can get a bad solution.. but must be a way to get ride of it..

thanks!

ps: I cant't bind the combo to the dbdatasource because it's already bounded to the table.

Former Member
0 Kudos

Hi all. I have the same problem as Curtis. Only appears first record int the list.

Former Member
0 Kudos

Thanks

Adele

Former Member
0 Kudos

Hi Shahid,

I did not answer your question, Barend did

Please award points to Barend to say the problem is solved.

Adele

barend_morkel2
Active Contributor
0 Kudos

Dim editTxt As SAPbouiCOM.ComboBox

'1. Define th DataSorce

oForm.DataSources.DBDataSources.Add("OCRD")

'Create an edit text item

editTxt = oForm.Items.Item("YourComboID").Specific

'2. Bind/Associate table OCRD field CardCode to the edit text

editTxt.DataBind.SetBound(True, "OCRD", "CardCode")

'Get Data

Dim oDBDS As SAPbouiCOM.DBDataSource

oDBDS = oForm.DataSources.DBDataSources.Item("OCRD")

oDBDS.Query()

Former Member
0 Kudos

Hey barend,

I am using your example to set the OCRD list into a combo box. I have followed the code line for line but my combo box will only show the first record in the list. it doesn't show any others.

Any idea why?

Former Member
0 Kudos

Hi Curtis,

Not sure which programming language you are using, but make sure that you are not getting an error somewhere in the code. Use a Try...Catch block around your code to catch the error message (if you're using Vb.Net).

Hope it helps,

Adele