Fill dropdown-listbox in managed code

M

mancha28

Hi,

I have a connection to an oracle database. I get some entries from a
table stored in a dataset. These entries I will bind on the listbox.
How can I implement this under c#?
 
F

Franck Dauché

Hi,

Because Oracle is not native to infoPath, you will have to build a Web
Service between Oracle in IP. In that case, you can bind your listbox to the
Web Service with no code.

Franck Dauché
 
D

D-Chavez

I'd imagine it would be something like:

[WebMethod (Description="Gets of the entries", CacheDuration=300)]
public string [] EnumerateEntries()
{
ArrayList entries = new ArrayList();
// Where this.GetEntriesFromDB() is your dataset populating function.
DataSet ds = this.GetEntriesFromDB();
foreach(DataRow myRow in ds.Table[ "YourTableName" ].Rows)
{
entries.Add( myRow[ "YourColumnName" ].ToString() );
}
return (string []) entries.ToArray( typeof(string) );
}

Then after you add/bind your drop down control in InfoPath, right click
on its properties, and select the radio button labled "Look up values
in a data connection to a database, Web service, file, or SharePoint
library or list".

Then add a data connection to your web service and you should be all
set.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top