Can I convet a query from an API into a Datasource to bind to?

P

Paul D. Fox

I have some sample code that queries through a products API. I'd like to convert this sample into a Datasource that I can bind to a Datagrid (instead of using the Console.WriteLine), but not sure as to how. Can anyone help? Here's the sample:

For i = 0 To queryResults.GetRowCount - 1
Dim document As IObjectQueryRow = queryResults.GetRow(i)
'Print out standard properties
Console.WriteLine("Document: " + document.GetName())
Console.WriteLine("Created: " + document.GetCreated())
Console.WriteLine("Last Modified: " + document.GetLastModified())
Console.WriteLine("Description: " + document.GetDescription())

Console.WriteLine("Description: " + document.

'Print out a Document-specific property
Console.WriteLine("Located at URL:" + document.GetStringValue(DocumentProperty.URL))
Next

Paul
 
E

Eliyahu Goldin

Paul,

Create a typed dataset with a table structured as the rows you are getting from the API. The VS will create a source code file with types, properties and methods facilitating access to the dataset. You can use this automatically created code to fill up the dataset. Then bind the dataset to the datagrid.


Eliyahu

I have some sample code that queries through a products API. I'd like to convert this sample into a Datasource that I can bind to a Datagrid (instead of using the Console.WriteLine), but not sure as to how. Can anyone help? Here's the sample:

For i = 0 To queryResults.GetRowCount - 1
Dim document As IObjectQueryRow = queryResults.GetRow(i)
'Print out standard properties
Console.WriteLine("Document: " + document.GetName())
Console.WriteLine("Created: " + document.GetCreated())
Console.WriteLine("Last Modified: " + document.GetLastModified())
Console.WriteLine("Description: " + document.GetDescription())

Console.WriteLine("Description: " + document.

'Print out a Document-specific property
Console.WriteLine("Located at URL:" + document.GetStringValue(DocumentProperty.URL))
Next

Paul
 
P

Paul D. Fox

I'm not quite following you. Do you have an example I can start with?

Paul
Paul,

Create a typed dataset with a table structured as the rows you are getting from the API. The VS will create a source code file with types, properties and methods facilitating access to the dataset. You can use this automatically created code to fill up the dataset. Then bind the dataset to the datagrid.


Eliyahu

I have some sample code that queries through a products API. I'd like to convert this sample into a Datasource that I can bind to a Datagrid (instead of using the Console.WriteLine), but not sure as to how. Can anyone help? Here's the sample:

For i = 0 To queryResults.GetRowCount - 1
Dim document As IObjectQueryRow = queryResults.GetRow(i)
'Print out standard properties
Console.WriteLine("Document: " + document.GetName())
Console.WriteLine("Created: " + document.GetCreated())
Console.WriteLine("Last Modified: " + document.GetLastModified())
Console.WriteLine("Description: " + document.GetDescription())

Console.WriteLine("Description: " + document.

'Print out a Document-specific property
Console.WriteLine("Located at URL:" + document.GetStringValue(DocumentProperty.URL))
Next

Paul
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top