In a C# 2.0 I have a list of fields and a list of values (stored as strings), a table name, and an ODBC Connection.
I need to get the data types of the fields that are on that table, so I know how to generate my sql.
What’s the best way to get that information from what I’ve got?
My only idea is to do a SELECT TOP 0 * FROM @TableName in a data adapter, get back a dataset, and iterate through the list of field names against the datacolumn’s in the datatable.
Is there any better way to go about this?
You’re best option is to query your datbases system tables like Nick Beradi mentioned. If that’s not an option for whatever reason, you can do something like this: