another listbox problem ;-) - InfoPath Dev
in

InfoPath Dev

another listbox problem ;-)

Last post 10-01-2005 01:13 AM by mephisto. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-30-2005 12:05 AM

    another listbox problem ;-)

    hello,

    i fill my listbox with a dataconnection to a sql-server. the listbox shows e.g. all cars available for rent. any entry gets a id as value from the sql-table. now i want to use the choosen entry in my c# code. i do not need the car, i need the value (id) of that. i tryed to get this by thisXDocument.DOM.selectSingleNode("my:myFields/my:Car").text but this don`t gets the id. how can i get the value?

    thx
    mephisto
  • 09-30-2005 07:29 AM In reply to

    Re: another listbox problem ;-)

    1) Double-click on your listbox in design mode and at the bottom where you have connected the list to a SQL database, you can choose what field you want to be the "Value" and what field you want to be the "Display Name". When you call selectSingleNode("...").text it will return the value of the field that you chose for "Value", not "Display Name". "Display Name" is simply what the user sees when they drop down the menu. Make sure that the "Display Name" is textual, but the MAIN thing that you need to do is make the "Value" field correspond with you "id" from your database.

    2) After you have done this, things will be a lot easier and you can query your database from within your code to gather all the information you could want. Your query statement would look like this:
    "SELECT * FROM _table_ WHERE id = \"" + parseInt(thisXDocument.DOM.selectSingleNode("my:myFields/my:Car").text) + "\""
    Of course, your code will be different depending on what language you're using (not exactly sure on yours), but you should get the gist of it.

    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 10-01-2005 01:13 AM In reply to

    Re: another listbox problem ;-)

    hello MFaus,

    thx for your answer! now i get the right id to query the sql-database!!! in my infopath-form the value and display-name was the same .... now i have the id as value ;-)

    thx very much

    mephisto
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.