Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

display item from table to combobox

Last post 03-25-2008 3:32 AM by qüeb.cesar. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-25-2008 2:12 AM

    display item from table to combobox

    hello..

    im working with vb.net...

    can u guys help me solve this problem with some sample code

     i want data from table Rate to display at combobox..

    this is my code:

     Private Sub AddArea_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            area = New AflexiArea
            AddRate()

        End Sub

        Sub AddRate()
            area = New AflexiArea
            ReadSqlData("select (id, value) from rate")
            While myReader.Read
                ComboBox1.Items.Add(myReader.GetValue(0))

                Exit While

            End While
            CloseSqlRead()
        End Sub

     but when i running the error msg said "ExecuteReaders required an open and Connection. The Connection current state is closed"
     it's wrong with my code??

    please help me..

    thanks 

    • Post Points: 10
  • 03-25-2008 3:05 AM In reply to

    Re: display item from table to combobox

    Could you please, post the code for the ReadSqlData method?

    The message indicates that the connection is missing. Sure in this method must be the error.

    Regards

    • Post Points: 10
  • 03-25-2008 3:29 AM In reply to

    Re: display item from table to combobox

     hello..

    thanks for ur concent.. 

    im done now... 

    actually no need put exit while 

     Sub AddRate()
            area = New AflexiArea
            ReadSqlData("select value from rate")
            While myReader.Read
                ComboBox1.Items.Add("RM " & myReader.GetValue(0))

            End While
            CloseSqlRead()
        End Sub

    this is the real code..

     

    thanks... 

    • Post Points: 10
  • 03-25-2008 3:32 AM In reply to

    Re: display item from table to combobox

    It's right.....

    Nice to read this!

    Your're welcome!

    • Post Points: 5
Page 1 of 1 (4 items)