Creating a SalesLogix table ID in .NET

I’ve had an article on slxdeveloper.com for a while now that shows how to create a SalesLogix table ID. The code samples are in VBScript, but I do get asked every now and then how to create a table ID from .NET. An easy enough translation from VBScript IMO. Here’s a generic method in C# you could use to create table ID values.

private string GetTableId(string table)
{
    if (table.Equals(string.Empty) throw new Exception("Table name missing");

    OleDbConnection conn = new OleDbConnection(_connstring);
    try
    {
        conn.Open();
        OleDbCommand cmd = new OleDbCommand(string.Format("slx_dbids('{0}', 1)", table), conn);
        return cmd.ExecuteScalar().ToString();
    }
    catch
    {
        throw;
    }
    finally
    {
        conn.Dispose();
        conn = null;
    }
}

Then to use it you’d just call it like this (but if you need to be told this, then should you really be using this??)

sring accountid = GetTableId("account");
ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!