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
159 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 500 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 500 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now