D
DrPete
Hi
How do you go about passing values to methods if you don't know what
the values datatype is?
For example:
myParm = sqlCommand.Parameters.Add("@Name", SqlDbType.VarChar, 30,
"Name");
myParm.Value = dataRow["NAME"].ToString();
I wish to have a method to validate a value instead of the second line,
e.g. the second line becomes
myParm.Value = validateParm(dataRow["NAME"].ToString());
private void validateParm(string theValue)
{
....
}
However, what happens if I want to pass in a datetime, or int? At the
moment i have seperate methods for each datatype but I know it's a bad
way of doing it!
Kind regards
Peter
How do you go about passing values to methods if you don't know what
the values datatype is?
For example:
myParm = sqlCommand.Parameters.Add("@Name", SqlDbType.VarChar, 30,
"Name");
myParm.Value = dataRow["NAME"].ToString();
I wish to have a method to validate a value instead of the second line,
e.g. the second line becomes
myParm.Value = validateParm(dataRow["NAME"].ToString());
private void validateParm(string theValue)
{
....
}
However, what happens if I want to pass in a datetime, or int? At the
moment i have seperate methods for each datatype but I know it's a bad
way of doing it!
Kind regards
Peter