Results 1 to 5 of 5

Thread: ComboBox+Database+Sourabh Das.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Posts
    220

    ComboBox+Database+Sourabh Das.

    Hi,
    There is a table in database which has 6 columns. I want to show only 4 selective columns. This is the code which I have written, what change do I need to do..

    Code:
    Dim selectstr As String
    selectstr = "select * from tbl_item where isdeleted=0"
    Dim ds As DataSet
    ds = New DataSet
    Dim adap As SqlDataAdapter
    adap = New SqlDataAdapter(selectstr, conn)
    adap.Fill(ds, "tbl_item")
    DataGrid1.DataSource = ds
    DataGrid1.DataMember = "tbl_item"
    Regards,
    Sourabh

  2. #2
    Fanatic Member
    Join Date
    Feb 2007
    Location
    Eindhoven
    Posts
    828

    Re: ComboBox+Database+Sourabh Das.

    You can either select the four columns you wanna show in side your sql statement
    vb Code:
    1. SELECT col1, col2, col3, col4 FROM table
    or you can select every columns like you are doing now and then search and hide the ones you don't wanna show in your grid.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Posts
    220

    Re: ComboBox+Database+Sourabh Das.

    yes,
    i need to select all the columns, because few column i am manupulating some where else, so out of all how do i show few in datagrid.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: ComboBox+Database+Sourabh Das.

    I fail to see the ComboBox connection in this thread. Anyway, this page has lot's of DataGrid information, including how to hide columns.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Posts
    220

    Re: Datagrid+Database+Sourabh Das.

    sorry it was by mistake combox.. it should have been datagrid.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width