cdbl and sql string

Results 1 to 2 of 2

Thread: cdbl and sql string

  1. #1
    Join Date
    Dec 1969

    Default cdbl and sql string

    I have an sql string that looks for products in my database with an "between price" criteria. This between price from and to input fields are filled in by the user on the search for products page. I need to do a cdbl for the 2 input field returns, and for the db columns which hold the product price as 23.00. This is what i am doing, but i get an error.<BR><BR>SQL = SQL & " AND (CDbl(sfProducts.prodPrice) BETWEEN " & CDbl(PriceStart) & " AND " & CDbl(PriceEnd) & " or (sfProducts.prodSaleIsActive=1 and CDbl(sfProducts.prodSalePrice) BETWEEN " & CDbl(PriceStart) & " AND " & CDbl(PriceEnd) & ")) " <BR><BR>error: cdbl is not a recognized function.

  2. #2
    Join Date
    Dec 1969

    Default Behövs inte välan.

    I do not see why you need cdbl at all. Supposedly the prodprice column is defined as some numeric datatype and hence you should not need to convert the column. Furthermore you should not need to convert the values in VB either as you are only doing string manipulation.<BR><BR><BR>cdbl is not a sql function, hence the error. To convert values between different datatypes you can use a cast expression.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts