D
david00001
I am trying to find code to generate the command parameters for
updating a datatable (of changes received from UI layer) in a middle
layer object. I want to use a dataadaptor to do the update.
I can easily generate the update, insert and delete sqls for the
command objects, but there seems to be a complete disconnect between
the column datatype info available from the datatable and the
Sqlparameter objects required to create the command objects.
For example, I know the source column name from the database that I
want to update back to, and I know what column in the datatable is the
data required. How do I work out that the string column from the
datatable requires a SqlDbType.VarChar with length of 60 ie varchar(60)
without going back to the database and querying system tables? Surely
the info must be availble somewhere in the datatable schema? How do I
get it?
This is very frustrating. All the sample code I can find is either the
usual kiddy code that assumes you only do simple things with these very
complex objects or so abstract that its useless to someone of
relatively normal intelligence.
Any help would be very greatly appreciated.
Thankyou
updating a datatable (of changes received from UI layer) in a middle
layer object. I want to use a dataadaptor to do the update.
I can easily generate the update, insert and delete sqls for the
command objects, but there seems to be a complete disconnect between
the column datatype info available from the datatable and the
Sqlparameter objects required to create the command objects.
For example, I know the source column name from the database that I
want to update back to, and I know what column in the datatable is the
data required. How do I work out that the string column from the
datatable requires a SqlDbType.VarChar with length of 60 ie varchar(60)
without going back to the database and querying system tables? Surely
the info must be availble somewhere in the datatable schema? How do I
get it?
This is very frustrating. All the sample code I can find is either the
usual kiddy code that assumes you only do simple things with these very
complex objects or so abstract that its useless to someone of
relatively normal intelligence.
Any help would be very greatly appreciated.
Thankyou