Insert and Update Queries in ComputerEase

I’m appreciative when I am able to quickly find a solution to a challenge. I tend to prefer to recall those times over long draw out battles, but see some of both, of course.

After I had given up trying to insert dates into ComputerEase, I tried again and found a post in the MSDN forum to be helpful.

Dates should follow the {d’yyyy-mm-dd} format. Here’s an example:

UPDATE jcjob SET name=’CUST NAME’, dateopen={d’1998-11-20′}, contractamt=1200.00 WHERE jobnum = ‘AK0002’

The trick here is padding the date with zeros as needed to make it 10 characters long. The following method [C#] may be useful.

/// <summary>
/// Returns a string that can be used to insert
/// the given date in the ComputerEase database
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
private static string FormatDateForQuery(DateTime date)
{
    return String.Format(@"{{d'{0:yyyy-MM-dd}'}}", date);
}

Advertisements

One thought on “Insert and Update Queries in ComputerEase

  1. Do you know if there is a way to query datetime? I am working with ComputerEase user defined fields but they don’t allow for creating a datetime field. The workaround was to create one date field and another “string” field that the user free-format types in the time. I was hoping to query records for a datetime as a combination of the two fields. Any help would be much appreciated. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s