The online help manual doesn't specify what values go in what fields of the Data Bindings section for a combo box.
In short, I set up a Datasource like this "Select vendorID, vendorName from tblVendor"
The combo box allows the user to select a vendor from the drop down.
The report's datasource looks like this "select * from tblVendor WHERE vendorID=@vendorID"
I set up a parameter called @vendorID and attached it to the comboBox like this: lstVendor.SelectedItem
The comboBox DataBindings, and I'm just guessing has
Items = VendorTable.vendorName
SelectedItem = VendorTable.vendorID
Which parameter should vendorID be bound to? SelectedItem, SelectedValue, or TagValue? And then on the parameter @vendorID, what should the fx be set to?
Is there any updated doc on this function?????
How to use Databindings on Combo Box?
How to use Databindings on Combo Box?
Hi Fuhrj,
Please open attached report in Designer.exe application. The report uses NWind.mdb sample database which comes with a standard installation of Stimulsoft Reports.Net. Please take into account that ConnectOnStart property of appropriate SQL DataSource has been set in false and DataSource.Connect() command called in ClickEvent of the button on form.
Updated documentation will be available with the next release of Stimulsoft Reports.Net.
Thank you.
Please open attached report in Designer.exe application. The report uses NWind.mdb sample database which comes with a standard installation of Stimulsoft Reports.Net. Please take into account that ConnectOnStart property of appropriate SQL DataSource has been set in false and DataSource.Connect() command called in ClickEvent of the button on form.
Updated documentation will be available with the next release of Stimulsoft Reports.Net.
Thank you.
- Attachments
-
- 134.ComboboxExampleAndSQLParameters.mrt
- (21.97 KiB) Downloaded 372 times
How to use Databindings on Combo Box?
Thank you for the example report! That has resolved my issue.
Quick question though. I noticed that you pull the categoryID in the form code like this:
I have been adding it directly to the parameter in the 'fx' parameter. I saw it done this way through one of the online tutorial videos.
Is the recommended practice to do it in the form code or does it matter?
Thanks again for the help.
Quick question though. I noticed that you pull the categoryID in the form code like this:
Code: Select all
int myVar;
int.TryParse(Categories.GetData("CategoriesID", ComboBox1.SelectedIndex).ToString(),out myVar);
Products.Parameters["@CategoryID"].ParameterValue = myVar;
Products.Connect();
Is the recommended practice to do it in the form code or does it matter?
Thanks again for the help.
How to use Databindings on Combo Box?
Hello Fuhrj,
No, it is not necessary and it is up to you to choose more convenient way in every particular situation.
Thank you.
No, it is not necessary and it is up to you to choose more convenient way in every particular situation.
Thank you.
How to use Databindings on Combo Box?
Thanks. One last question.
Can you explain what this method is doing:
Categories.GetData("CategoriesID", ComboBox1.SelectedIndex)
Does the combo box not store both category name and categoryID?
Can you explain what this method is doing:
Categories.GetData("CategoriesID", ComboBox1.SelectedIndex)
Does the combo box not store both category name and categoryID?
How to use Databindings on Combo Box?
Categories.GetData("CategoriesID", ComboBox1.SelectedIndex)
This method returns value of the Categories.CategoriesID of the DataSource in the row which has 'ComboBox1.SelectedIndex' number.
Thank you.
This method returns value of the Categories.CategoriesID of the DataSource in the row which has 'ComboBox1.SelectedIndex' number.
Thank you.