May 20, 2007 at 4:16 pm
I had the following SQL query which I used to run from an ASP page.
"select fname, lname, email from directory where admit_term < '" & cint(year(date))-3 & "01'" The above query ran fine. But now I am trying to execute the same query from ASP.NET page and I get an error: Compiler Error Message: CS0103: The name 'Cint' does not exist in the current context Does anyone who if there is any substitute for Cint in a SQL query while running from ASP.NET page. I am using C#, SQL2k5 on Win2k3 server. Thanks
May 20, 2007 at 7:55 pm
Search for cast, or convert in the help files. You will find the correct function to do the conversion. I would give it to you now but I forgot the exact name and I have no access to a .net help file!
May 20, 2007 at 11:43 pm
The thing you are looking for is the C# code to convert to int
"select fname, lname, email from directory where admit_term < '" & cint(year(date))-3 & "01'"
You should write this in C# as ...
int fp = Convert.ToInt16(DateTime.Now.Year)-3;
string Qry = "select fname, lname, email from directory where admit_term < '" + fp.ToString() + "01'";
fp contains your query to be executed.
Hope it worked for you.
FP
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply