I have a list of fields in C # 2.0 and there is a list of values (stored in the form of wire), the name of a table, and an ODBC connection
The data types of the fields on that table Need to get, so I know how to make your own SQL
What is the best way to get that information?
My only idea is to do a SELECT TOP 0 * to @TableName
in a data adapter, get a dataset back, and again through the list of field names, Against.
Is there a better way to do this?
You are the best choice that your Databases system table such as Nick Beradi has mentioned. If this is not an option for any reason, then you can do something like:
using (SqlConnection conn = new SqlConnection (myConnectionString)) {(SqlDataAdapter adapter = New SqlDataAdapter ("SELECT * from MyTable", conn)) {DataTable table = New DataTable (); Adapter. Philsema (table, schema type map); // At this point, there will be no row in the table, but all the columns will be from which you can get your datatpe}}