Hi there.


I basically am making a method which will create parameters and what not in order to execute stored procedures in SQL.

I was wondering, is there a way that I can specify in the parameters.add command, an object which holds the information on the datatype of a field?

This would save me a lot of time than doing tons of if else statements checking the data type on the field from a table object (which has fields, and its data types).

So I would have something like:

Command.Parameters.Add(“@fieldName”, SqlDbType.Int, 4);

since this method expects a table object, each table object has an array of fields, the array of fields contains information about the fields. (data type, max length, field name etc...)

The second parameter, I wouldn’t know what field data type it is, but I can get that data type by querying the field object data type attribute, which brings back me the result in a string.



I hope you understand what I mean…