Skip to Content
author's profile photo Former Member
Former Member

Display values in Combobox from Database

Hi All,

I have obne combox in my screenpainter form. I want to populate values from database in this combo. I am using following code

combobox.DataBind.SetBound(True, "OITM", "ItemName")

I am getting error as Table not found.

Can anyone tell me where is the problem.

Tha nks & regards

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 13, 2008 at 12:42 PM

    Hi Sheetal,

    U'll not get the values in the combobox after u just bind it. U have to add the values. The folowing is the sample code just check it.

    strSQL = "SELECT Code,Location FROM OLCT"
                objRecSet.DoQuery(strSQL)
                oComboBox.ValidValues.Add("None", "None")
                For i As Integer = 0 To objRecSet.RecordCount - 1
                    oComboBox.ValidValues.Add(objRecSet.Fields.Item(0).Value, objRecSet.Fields.Item(1).Value)
                    objRecSet.MoveNext()
                Next

    Hope it helps u.

    Regards,

    Vasu Natari.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.