none
adding items in combo box

    Question

  • how can i add items in combo box from datasource.I m using ADODC. plz help me
    Wednesday, November 11, 2009 10:03 AM

Answers

  • There is a fill fills a dataset from a recordset, but you have not much benefit from that.

    The recordset becomes never binded to the modern controls.

    Your best alternative is Linq To SQL (if you use an SQL database) as that acts the most as the recordset with its next and previous.

    If it is only for presention you can simply use your recordset in a loop until last and create from that a generic dictionary, you have than also a display and a value member


    Success
    Cor
    • Marked as answer by YiChun Chen Friday, November 13, 2009 9:55 AM
    Wednesday, November 11, 2009 11:51 AM
  • how can i add items in combo box from datasource.I m using ADODC. plz help me

    That is what you need:
    
    

     

    Using CNET As New OdbcConnection(sStrin)

     

    Dim command As New OdbcCommand("Select * From Table_INF", CNET)

     

    Dim RRreader As OdbcDataReader = command.ExecuteReader

     

    With RRreader

     

    If .HasRows Then

    .Read()

     

    Dim DB As New BindingSource

    DB.DataSource = RRreader

     

    Me.DataGridView1.DataSource = DB

     

    End If

     

    End With

    Please dont forget to import it at the top of your form: Imports System.Data.Odbc

    Don't judge me, just Upgrade me. Thanks!
    • Marked as answer by YiChun Chen Friday, November 13, 2009 9:56 AM
    Thursday, November 12, 2009 10:10 PM
  • how can i add items in combo box from datasource.I m using ADODC. plz help me

    this the way your connection string should look:

    Dim

     

    myConnection As String = ("DRIVER={SQL Server};SERVER=LEVI-PC\SQLEXPRESS;Trusted_connection=yes;DATABASE=Teste_One;")


    sorry, dont forget to open the database:

    CNET.Open()


    Don't judge me, just Upgrade me. Thanks!
    • Marked as answer by YiChun Chen Friday, November 13, 2009 9:56 AM
    Thursday, November 12, 2009 10:24 PM

All replies

  • There is a fill fills a dataset from a recordset, but you have not much benefit from that.

    The recordset becomes never binded to the modern controls.

    Your best alternative is Linq To SQL (if you use an SQL database) as that acts the most as the recordset with its next and previous.

    If it is only for presention you can simply use your recordset in a loop until last and create from that a generic dictionary, you have than also a display and a value member


    Success
    Cor
    • Marked as answer by YiChun Chen Friday, November 13, 2009 9:55 AM
    Wednesday, November 11, 2009 11:51 AM
  • Do you mean ADODB?  Is there a reason you are using this very old technology?  Have you tried using ADO.NET -- its built into the .NET framework and offers many advantages.
    Wednesday, November 11, 2009 1:22 PM
  • how can i add items in combo box from datasource.I m using ADODC. plz help me

    That is what you need:
    
    

     

    Using CNET As New OdbcConnection(sStrin)

     

    Dim command As New OdbcCommand("Select * From Table_INF", CNET)

     

    Dim RRreader As OdbcDataReader = command.ExecuteReader

     

    With RRreader

     

    If .HasRows Then

    .Read()

     

    Dim DB As New BindingSource

    DB.DataSource = RRreader

     

    Me.DataGridView1.DataSource = DB

     

    End If

     

    End With

    Please dont forget to import it at the top of your form: Imports System.Data.Odbc

    Don't judge me, just Upgrade me. Thanks!
    • Marked as answer by YiChun Chen Friday, November 13, 2009 9:56 AM
    Thursday, November 12, 2009 10:10 PM
  • how can i add items in combo box from datasource.I m using ADODC. plz help me

    this the way your connection string should look:

    Dim

     

    myConnection As String = ("DRIVER={SQL Server};SERVER=LEVI-PC\SQLEXPRESS;Trusted_connection=yes;DATABASE=Teste_One;")


    sorry, dont forget to open the database:

    CNET.Open()


    Don't judge me, just Upgrade me. Thanks!
    • Marked as answer by YiChun Chen Friday, November 13, 2009 9:56 AM
    Thursday, November 12, 2009 10:24 PM