IQClient client = Intuit.QuickBase.Client.QuickBase.Login("username", "pwd");
IQApplication app = client.Connect(applicationId, token);
Intuit.QuickBase.Client.IQTable rtable = app.GetTable(sTableID);`
I am creating a web application in asp.net. I need to get data from quickbase to populate my GridView. I am using Quickbase API.The above code retrieves the table, but records value is always 0. Am I doing anything wrong or Is there any other way to do this?
To get all of the records in the table you can follow the example at the following site: https://code.intuit.com/sf/wiki/do/viewPage/projects.quickbase_c_sdk/wiki/HomePage .
using System;
using Intuit.QuickBase.Client;
namespace MyProgram.QB.Interaction
{
class MyApplication
{
static void Main(string[] args)
{
var client = QuickBase.Client.QuickBase.Login("your_QB_username", "your_QB_password");
var application = client.Connect("your_app_dbid", "your_app_token");
var table = application.GetTable("your_table_dbid");
table.Query();
foreach(var record in table.Records)
{
Console.WriteLine(record["your_column_heading"]);
}
client.Logout();
}
}
}
To do specific query using the already built C# API, you can do the following:
var querystring1 = new QueryStrings(FieldID,ComparisonOperator.GTE,value,LogicalOperator.AND);
var querystring2 = new QueryStrings(FieldID, ComparisonOperator.XEX, value, LogicalOperator.NONE);
then
var query = new Query();
query.Add(querystring1);
query.Add(querystring2);
table.Query(query, new[] { 1,2,3,4}, new[] { 1,2});
The second parameter is the field IDs of the columns you want and the Third parameter is the field ID's to sort the records by.
In your case I would just do the loop and add all the records to a collection. Then you could probably use LINQ or just the column headings to loop through all your records.
This is the way I did it to get specific data:
foreach(var record in table.Records)
{
var row = new String[8];
row[0] = record["Column Name"];
row[1] = record["Column Name"];
row[2] = record["Column Name"];
row[3] = record["Column Name"];
row[4] = record["Column Name"];
row[5] = record["Column Name"];
row[6] = record["Column Name"];
row[7] = record["Column Name"];
list.Add(row);//This is a List<string[]> collection. But use what you want
}