Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 876141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:23:10+00:00 2026-05-15T11:23:10+00:00

i am working on a search feature for a program i am working on

  • 0

i am working on a search feature for a program i am working on and i found a tutorial online that provides some insight but the actual code, after being modified to fit my aplication, does not work. i get two different errors as of right now, one that tells me “the value of type ‘System.data.sqlclient.sqldatareader’ cannot be converted to ‘1-dimensional array of system.data.sqlclient.sqldatareader” and the other that says”argument not specified for parameter ‘array’ of ‘Public shared function… anyway i am kinda new to this and here is what i have so far. any advice?

Private Sub SearchOKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SearchOKButton.Click

Dim TrNum
    Dim dr As SqlDataReader()

    TrNum = Me.SearchText.Text()

   Using connection As New SqlClient.SqlConnection("Data Source=XXXXX;Initial Catalog=YYYYY;Integrated Security=True;Pooling=False;Encrypt=False"), _
    cmd As New SqlClient.SqlCommand("SELECT [YYYYY] FROM (TrackingNumber) WHERE TrackingNumber = 'TrNum'", connection)

        connection.Open()
        dr = cmd.ExecuteReader()
        While dr.AsReadOnly()
            MsgBox("TrackingNumber" + "Date")
        End While
        connection.Close()

    End Using

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:23:11+00:00Added an answer on May 15, 2026 at 11:23 am

    There are multiple problems here…

    Edited:

    I assume that TrackingNumber is the table you are querying, and that table contains columns TrackingNumber and Date.

    Dim TrNum as String = Me.SearchText.Text ' <== Text is a property, not a function
    
    Dim connectionString as string = "Data Source=XXXXX;Initial Catalog=YYYYY;Integrated Security=True;Pooling=False;Encrypt=False"
    
    Dim cmdText as string = "SELECT TrackingNumber, [date] " & _
                            "FROM TrackingNumber " & _
                            "WHERE TrackingNumber = @trackingNumber"
    
    Using connection As New SqlClient.SqlConnection(connectionString)
    
        Dim cmd As New SqlClient.SqlCommand(cmdText, connection)
    
        ' assign TrNum to @trackingNumber
        cmd.Parameters.AddWithValue("@trackingNumber", TrNum)    
        connection.Open()
        dim dr as SqlDataReader = cmd.ExecuteReader()
    
        While dr.Read()       ' <== this is probably what you want
            MsgBox(string.Format("{0} {1}", dr("TrackingNumber"), dr("Date"))
        End While
    
    End Using
    

    The point of the Using syntax is to automatically close the connection when the variable goes out of scope.

    You should probably keep your connection string in the web.config.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working an a search page that allows users to search for houses
I'm working on a problem that requires caching paginated search results: Paginating very large
I am working on a website that currently has a number of disparate search
I'm working on a search feature for my application, I want to search all
I'm implementing a basic search feature for a site I'm working on. The cleanest
I'm working on a feature to export search results to a CSV file to
I'm trying to get a simple search form working in my RoR site. I've
I'm working on an 'advanced search' page on a site where you would enter
I'm currently working on a Google Maps project and am implementing a search function.
I'm trying to get a case-insensitive search with two strings in JavaScript working. Normally

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.