Programmatically extract data types for MS SQL table columns for later insertion
Rails has an awesome way of finding column names and expected data types from the database, making a lot of programming easier.
I am trying to create something like this in C # .NET because we have large tables that are changing. I will add parameters like this:
SqlParameter param = new SqlParameter("parametername", *SqlDbType.Int*);
param.Direction = ParameterDirection.Input;
param.Value = 0;
comm.Parameters.Add(param);
Pay attention to the SqlDbType. How can I get it? If I get DataColumns from a DataSet, all I can get are system types like System.string.
+1
source to share
2 answers