hi I wrote the code below for fetch data from database with ADO.net to show in kendoGrid in My webservice :
var result = new List<Timeline>();
TimelineDB _TimelineDB = new TimelineDB();
SPSecurity.RunWithElevatedPrivileges(delegate ()
{
_TimelineDB.loadTimeline_bulk(result, currentUserName);
});
return result;
the code wrote in DB layer :
public GeneralDAL.OperationStatus loadTimeline_bulk(List<Timeline> ListTimeline_bulk, string id_user)
{
GeneralDAL.OperationStatus operationStatus = GeneralDAL.OperationStatus.OperationSuccessful;
try
{
SqlCommand sqlCommand = new SqlCommand(Returnsp_tbl_TimelineLstShow_bulk(id_user));
sqlCommand.CommandType = CommandType.Text;
using (SqlConnection connection = new SqlConnection(GeneralDAL.con))
{
sqlCommand.Connection = connection;
try
{
connection.Open();
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
try
{
while (sqlDataReader.Read())
ListTimeline_bulk.Add(new Timeline()
{
ID_Timeline_bulk = sqlDataReader.IsDBNull(sqlDataReader.GetOrdinal(Timeline.Fildes.ID_Timeline_bulk)) ? General.DefaultValues.Numricguid : sqlDataReader.GetGuid(sqlDataReader.GetOrdinal(Timeline.Fildes.ID_Timeline_bulk)),
and many field but when i debugging the exp eroe :
Unable to cast object of type 'System.Int32' to type 'System.String'.