9
Answers

Conversion from string to int in LINQ to SQL query

Ruchi Sharavat

Ruchi Sharavat

3y
6.1k
1
In Sql i have a string column which stores time value in mm:ss format. While writing LINQ to SQL query in C# I need to add that time value in date value which is another sql column.
 
To do that i will have to write
  1. DBFunction.AddHours(DateColumn,(double)TimeColumn.Substring(0,2)   
but it gives complie time error.
 
I tried  
 
DBFunction.AddHours(DateColumn,Convert.ToDouble(TimeColumn.Substring(0,2)) but it gives run time error as it is non supported method.
 
What is the solution if anyone can help. 
Answers (9)