Public void TimeExample(TdCommand cmd, String studentId, String classId)
{
cmd.Parameters.Clear();
cmd.CommandText = "TimeEnrolledInClass";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(null, TdType.Varchar, 9,
System.Data.ParameterDirection.Input, true, 0, 0, null,
System.Data.DataRowVersion.Default, studentId);
cmd.Parameters.Add(null, TdType.Varchar, 9,
System.Data.ParameterDirection.Input, true, 0, 0, null,
System.Data.DataRowVersion.Default, classId);
cmd.Parameters.Add(null, TdType.Timestamp, 0,
System.Data.ParameterDirection.Output, true, 0, 0, null,
System.Data.DataRowVersion.Default, null);
cmd.ExecuteNonQuery();
// Using TdTimestam to get the time that the student enrolled
// in the class
TdTimestamp timeEnrolled = (TdTimestamp)cmd.Parameters[2].ProviderSpecificValue;
// Going to add 5 days to the time Enrolled.
TdTimestamp newTime = timeEnrolled + new TimeSpan(5, 0, 0);
// going to typecast the newTime to a TdDate
TdDate dateEnrolled = (TdDate)timeEnrolled;
// going to print out the timeEnrolled to the console
Console.WriteLine("Time enrolled {0}", timeEnrolled);
// going to convert the timeEnrolled to a String
String enrolled = timeEnrolled.ToString();
}