Results 1 to 13 of 13

Thread: no results found

Hybrid View

  1. #1
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: no results found

    Quote Originally Posted by pame1la
    but it doesnt let me open the rs, comes up with that error!!! i can only check the state if its open rite?!
    Guessing that you got an error on the SQL side then - so no RS at all...

    So check

    Code:
    If rs is Nothing Then
       MsgBox "Got no RS"
    End if

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2005
    Posts
    334

    Re: no results found

    Private Sub Serach_Click()
    If txtName.Text = "" Then
    MsgBox "Please enter product name", vbOKOnly, "Search Error"
    Else
    Str = "SELECT * From Details WHERE ItemName = '" & txtName.Text & "'"""
    rs.Open strTemp, gcnSV, adOpenForwardOnly, adLockReadOnly
    If rs.State = 0 Then
    MsgBox "No records match", vbOKOnly, "Search Result"

    or

    Private Sub Serach_Click()
    If txtName.Text = "" Then
    MsgBox "Please enter product name", vbOKOnly, "Search Error"
    Else
    Str = "SELECT * From Details WHERE ItemName = '" & txtName.Text & "'"""
    If Str = "" Then
    MsgBox "No records match", vbOKOnly, "Search Result"

    WHAT AM I DOIN WRONG?

  3. #3
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: no results found

    Quote Originally Posted by pame1la
    Private Sub Serach_Click()
    If txtName.Text = "" Then
    MsgBox "Please enter product name", vbOKOnly, "Search Error"
    Else
    Str = "SELECT * From Details WHERE ItemName = '" & txtName.Text & "'"""
    rs.Open strTemp, gcnSV, adOpenForwardOnly, adLockReadOnly
    If rs.State = 0 Then
    MsgBox "No records match", vbOKOnly, "Search Result"

    or

    Private Sub Serach_Click()
    If txtName.Text = "" Then
    MsgBox "Please enter product name", vbOKOnly, "Search Error"
    Else
    Str = "SELECT * From Details WHERE ItemName = '" & txtName.Text & "'"""
    If Str = "" Then
    MsgBox "No records match", vbOKOnly, "Search Result"

    WHAT AM I DOIN WRONG?
    What is this mess at the end of the string??

    Str = "SELECT * From Details WHERE ItemName = '" & txtName.Text & "'"""


    It should simply be:

    Code:
    Str = "SELECT * From Details WHERE ItemName = '" & txtName.Text & "'"

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

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