Getting Column values from sql Db

e.g:-

CustomClass task = new CustomClass ();
task.OrderID = tasksReader.GetGuid(0);
task.OrderNumber = tasksReader.GetString(1);
task.DueDate = tasksReader.IsDBNull(3) ? DateTime.MaxValue : tasksReader.GetDateTime(3);
task.Status = (TaskStatus)tasksReader.GetInt32(4);



e.g:-
GetString(1) will get the column(1) from the database as a string.

Similarly GetDateTime(3) will fetch the 3rd column from database as DateTime type.

No comments:

Post a Comment