CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 1999
    Location
    CA
    Posts
    91

    SQL not working with ASP

    I've got this sql string that will work in access directly, but won't work in my asp pages. Please help.

    SELECT Pprojects.* FROM Pprojects WHERE (([Pprojects].[JState] = 'CA') And (InStr(' 2, 1, 3,',' ' & [Pprojects].[County] & ',') > 0)) Or ((InStr(' 2, 1,', ' ' & [Pprojects].[Type] & ',') > 0)) Or ((InStr(' 2, 3, 1,', ' ' & [Pprojects].[Phase] & ',') > 0))

    I've also tried using the like operator (and using both * and % as wildcards) but still no dice:

    SELECT Pprojects.* FROM Pprojects WHERE (([Pprojects].[JState] = 'CA') And (' 2, 1, 3,' Like '* ' & [Pprojects].[County] & ',*')) Or ((' 2, 1,' Like '* ' & [Pprojects].[Type] & ',*')) Or ((' 2, 3, 1,' Like '* ' & [Pprojects].[Phase] & ',*'))


    Neither form will work in my asp pages, but work perfectly fine in access. (By not working, I mean that it pulls up zero results every time, when it should be pulling up everything in the table.) The sql also includes some Left joins, but I've excluded them for this example. If the joins would have any part to play with why this is not working, please let me know.

    Brewguru99

  2. #2
    Join Date
    Oct 1999
    Location
    CA
    Posts
    91

    Nevermind, Got it...

    Of all the stupid things to overlook I'm sure you guys can see what is wrong with my code here...


    If rstProjects.RecordCount > 0 then
    'No matches found
    else
    'Display results
    End If




    Sheesh.

    Brewguru99

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured