?
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
?
175 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 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