Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

VB.NET question?

this is what I am trying, create a text box and a find Button( this is done) , then I will look in a database ( the database is done) then I will do a query in two tables ( this is not done) my query should look something like this:

Select itemTitle FROM dbo.eList

WHERE empID=@EmplID AND eList.listID = 1

the thing is that I dont know where to write this and then I dont know how to get this results ( bunch of strings and then populate a combobox, then I should be able to choose from them to do another handling button.

Can someone please help!

I am a newbie with VB.Net

2 Answers

Relevance
  • rod
    Lv 6
    1 decade ago
    Favorite Answer

    Where to write depends on when you want it. If you want the data as soon as the page opens..put it in the Page_Load event. If you want it after the FIND button is clicked, put it in the FIND_onClick event.

    Set up your connection string to the database and call it MyConnection

    MyConnection.Open()

    Dim MyQuery As New StringBuilder

    MyQuery.AppendLine("SELECT itemTitle ")

    MyQuery.AppendLine(" FROM dbo.eList '')

    MyQuery.AppendLine("WHERE (empID=@EmplID) ")

    MyQuery.AppendLine("AND eList.listID = 1) ")

    Using MyCommand As New SqlCommand(MyQuery.ToString, MyConnection)

    MyCommand.Parameters.Add("@EmpId", SqlDbType.Int).Value = CInt("UplineId"))

    Using MyDataReader As SqlDataReader = MyCommand.ExecuteReader

    While MyDataReader.Read

    stringOne = first record

    OR comboOne.addItem = first record

    end while

    end using

    end using

    hope that helps

  • 4 years ago

    that is many times stressful to respond to "what's greater suitable" questions, yet consequently VB 2010 show is obviously greater suitable. The VB 2010 language can do each thing VB6 can and so lots greater, and the form kit are far greater advantageous in 2010. the biggest distinction is that VB6 is now out of date. The VB6 progression kit can now no longer be offered, and in case you do have a replica that is now no longer supported by potential of Microsoft. Microsoft additionally does not help working the form gadget on a sixty 4-bit OS. VB6 apps will run on all present Microsoft OSs, yet there isn't any assure that this could proceed in destiny variations.

Still have questions? Get your answers by asking now.