tags:

views:

796

answers:

3

Progress databases allow for a Character[x] datatype. How can I write to a particular x using C# and ODBC?

Please do not answer unless you understand the what Character[x] means... it is not a string (array of chars), it is an array of strings (which are arrays of chars).

A: 

The Progress ODBC Driver Guide doesn't seem to mention that type at all?

Rowland Shaw
+1  A: 

I figured it out. The documentation I have refers to a datatype of character[20], format x(24). character[x] (where x is a number), is like an array of strings. Format x(24) means each string in the array can be 24 characters long.

Essentially characters[20], format x(24) is a string that is 20 * 24 characters long with each "array element" separated with a semi-colon (;).

If column "options" is defined as character[20], x(24) then to populate it with strings from 1 to 20, one would merely write:

row.options = "1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20";

To populate it with all empty strings write:

row.options = ";;;;;;;;;;;;;;;;;;;";

+2  A: 

Format x(24) means each string in the array can be 24 characters long.

Not quite accurate, the format is a DISPLAY format, which is used by a lot of the Progress routines when displaying / printing / exporting this field. All character fields, whether they have an extent or not, are stored on the DB as variable length string. So you could easily have up to about 32K worth of data in each of your 20 extents.

Gordon Robertson
You're not really answering his question, but +1 for correcting him on the display formatting.
Jason Down