Results 1 to 4 of 4

Thread: Send message to user if Where clause is not found in DataReader (solved)

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2003
    Location
    Three Rivers, MI
    Posts
    354

    Send message to user if Where clause is not found in DataReader (solved)

    How do I catch and send a message to the user if the text entered in the Where clause is not found among the records in the data reader?

    VB Code:
    1. Try
    2.     cnn.ConnectionString = (.........)
    3.     cnn.Open()
    4.     cmd = cnn.CreateCommand
    5.     cmd.CommandText = "SELECT Phase FROM JCPM WHERE VbPhase=" _
    6.             & "'" & txtPC.Text & "'"
    7.     dr = cmd.ExecuteReader
    8.         While dr.Read()
    9.             txtPhaseCode.Text = dr("Phase")
    10.         End While
    11.         dr.Close()
    12.         cnn.Close()
    13. Catch ex As Exception
    14.     MsgBox("Error: " & ex.Source & ": " & ex.Message, _
    15.             MsgBoxStyle.OKOnly, "Job Name Error")
    16. End Try
    Last edited by BukHix; Dec 19th, 2003 at 12:38 PM.

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