Ok here is a basic solution for querying a Commence Database
protected void Page_Load(object sender, EventArgs e)
{
// connect to commence
FormOA.CommenceDB TestCommenceView = new FormOA.CommenceDB();
// sample1: just connect and query the commence version
try
{
// connect to commence, query the program version and display the version
Label1.Text = TestCommenceView.VersionExt;
}
catch (Exception Ex)
{
Label1.Text = Ex.Message.ToString();
}
// sample2: connect and query out data from the view
int mode = 1;
int flags = 0;
//I created a View Called People
// -wtp, updated to view name in the tutorial db
// use Help-Tutorial command in cmc to open this db
string CMview = "Contact List";
// create cursor object
FormOA.ICommenceCursor RevealObject;
try
{
RevealObject = TestCommenceView.GetCursor(mode, CMview, flags);
FormOA.ICommenceQueryRowSet qrs = RevealObject.GetQueryRowSet(1, 0);
// get string with values for all columns (gets the full row)
string str = qrs.GetRow(0, "|", 0);
Label1.Text = str;
// get string with value for 1 column
str = qrs.GetRowValue(0, 0, 0);
Label1.Text = str;
// disconnect from cmc
qrs = null;
RevealObject = null;
}
catch (Exception Ex)
{
Label1.Text = Ex.Message.ToString();
}
// disconnect from cmc
TestCommenceView = null;
}
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56:





by: bcolladayPosted on 2009-09-02 at 13:18:43ID: 25245180
Here is the company's documentation
Commence.DB manual