The .NET DataRow will automatically try to cast your value to the target type. The following code runs fine, even though the column type is int
DataSet ds = new DataSet();
ds.Tables.Add();
ds.Tables[0].Columns.Add("COLUMN1", typeof(int));
DataRow dr = ds.Tables[0].NewRow();
Type t = ds.Tables[0].Columns["COLUMN1"].DataType;
dr["COLUMN1"] = "4";
However adding an incorrect value will yield an exception
dr["COLUMN1"] = "four";
EDIT:
For sql types that have a parse method you can use reflection. Some types like SqlString, dont require manual parsing and can be handled by the DataRow
DataSet ds = new DataSet();
ds.Tables.Add();
ds.Tables[0].Columns.Add("COLUMN1", typeof(SqlInt32));
DataRow dr = ds.Tables[0].NewRow();
string value = "4";
Type t = ds.Tables[0].Columns["COLUMN1"].DataType;
MethodInfo methodInfo = t.GetMethod("Parse");
if (methodInfo != null)
{
dr["COLUMN1"] = methodInfo.Invoke(null, new object[] { value });
}
else
{
dr["COLUMN1"] = value;
}