?
Solved

How can I search certain info out of a datasource and fill other text box in the form with info of the same row where my search string is?

Posted on 2009-04-11
5
Medium Priority
?
184 Views
Last Modified: 2013-11-08
Bassically the customer will enter the part numbers and then click on "search..."  to find the rest of the information from the database. Please See file attached.
I have implemented no code using a database yet. I do have a code to search into an excel list but it is very slow. I am not very good with databases but I have to realice that it migh be the only way to find the part info very fast.
Project-Print-Screen.JPG
0
Comment
Question by:nandostyle
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:brandonvmoore
ID: 24124386
How many items are in your excel sheet and what method are you using to search it?  It may be possible to implement a better way to search the spreadsheet.  However, a database would be better as you say.

While this place is great for getting specific questions answered, it's not the best place for getting 'lessons'.  You probably should find a tutorial on the subject (google searches will reveal plenty of them) and then come ask questions on any specific issues you are having.
0
 

Author Comment

by:nandostyle
ID: 24124406
There are 19000 items in the spredsheet, definetly not a good way to go.
basically I know how to bind the text boxes to the database, but again I just need the user to enter the part numbers into the partnumber text boxes and the be able to seach the database and indext the text box to the record index where the search string was found.

What will be the "Select" string and how do I pinpoint the inded contol to the found index?
0
 

Author Comment

by:nandostyle
ID: 24124409
I have been looking for this type of info,  watching videos and stuff but still confused.
0
 
LVL 5

Accepted Solution

by:
brandonvmoore earned 1500 total points
ID: 24124433
Here is a code example I pulled from another site for you.  Don't expect to understand what's going on right away though.  It's not complicated, but you will need to spend some time looking at each of the objects used in the example and the help documentation on them so that you can understand how to apply it to what you need.  This isn't intended to be an end answer for your problem, but just a starting point to show you what you can be studying to learn how to do what you want.

Private Sub ReadOrderData(ByVal connectionString As String)
    Dim queryString As String = _
        "SELECT OrderID, CustomerID FROM dbo.Orders;"

    Using connection As New SqlConnection(connectionString)
        Dim command As New SqlCommand(queryString, connection)
        connection.Open()

        Dim reader As SqlDataReader = command.ExecuteReader()

        ' Call Read before accessing data.
        While reader.Read()
            Console.WriteLine(String.Format("{0}, {1}", _
                reader(0), reader(1)))
        End While

        ' Call Close when done reading.
        reader.Close()
    End Using
End Sub

Notice that this routine has a string passed to it that is the connection string for the database.  Your connection string should look something like this:

"Data Source=SQLInstance;Initial Catalog=myDataBase;Integrated Security=SSPI;"

In the above line SQLInstance will actually be replaced by your computer name + \ + the name of the sql instance you are using.  When you install SQL Server Express you have the option to install it as the default instance, or as a named instance.  Unless you specify otherwise though, it will be installed as a named instance called SQLExpress.  This means that if the name of your computer is nondostyle, then you will replace SQLInstance with nondostyle\SQLExpress.  If you're using a default instance then it will just be nandostyle.  myDataBase will be replaced with whatever you call your database.  The third part of that string just says that you want to connect to the database using the same credentials that you used to log into windows with (so you'll need to be logged in as a user with administrative priveledges).

OK, that's way more than I intended to write so you'll have to take it from here and come back with any specific issues you run into to.

Good Luck.
0
 
LVL 5

Assisted Solution

by:brandonvmoore
brandonvmoore earned 1500 total points
ID: 24124437
By the way, this is just one method.  There are other methods, like using ADO.net.  The documentation that comes wih Visual Basic is actually very, very helpful once you learn to navigate it and it will give you an overview of your options and how to implement them.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month6 days, 10 hours left to enroll

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question