Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Reply to Thread

Post a reply to the thread: ASP.NET VB.NET SQL Question?

Your Message

Click here to log in

What comes after M0nday

 
 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Rate Thread

You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.

Topic Review (Newest First)

  • 02-16-2011, 05:04 AM
    Colby

    ASP.NET VB.NET SQL Question?

    Please can somebody help me with this.
    Basically I need some VB.NET code to sort this I need some code like:
    Try
    Using myConnection As New SqlConnection(ConfigurationManager.ConnectionStrin gs("ConnectionString").ConnectionString)
    Dim SQL As String = "SELECT * FROM [data] WHERE [title] LIKE '" & Request.QueryString("q") & "_'"
    Dim myCommand As New SqlCommand(SQL, myConnection)
    myConnection.Open()
    Dim myReader As SqlDataReader = myCommand.ExecuteReader
    If myReader.Read Then
    results_found = 1
    For Each result In myReader
    results_found = results_found + 1
    Next
    End If
    myReader.Close()
    myConnection.Close()
    End Using
    Catch ex As Exception
    End Try

    What I want to do it be able to search the database. So I need a select command like SELECT * FROM [data] WHERE [title] LIKE '_query-here_'.
    So I want to almost make it flexible so someone doesn't have to search for example "Google Mail" that could just type "Mail" and it would bring up Google Mail.
    I know you can do this with a SQLDataSource but I need the VB.NET code.

    Thanks for any help

Posting Permissions

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