Cint alternative in SQL for ASP.NET page

  • 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

  • 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!

  • 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


    FP

    True Love is Like A Ghost. Everyone Talks About It & Nobody have seen it.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply