Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am using vb.net windows app. 2005 with ms access.
In my form I am using dtatgrid view.
I want to retrieve all records of databse to my gridviewcontrol.

But in gridview I have 5 unbound columns.
In form load event I am writing this code.

        Try
    If (cn.State = ConnectionState.Open) Then
        str = "select lrry_sr_no,lrry_item_name,lrry_item_quantity,lrry_item_weight,lrry_item_unitofmeasurement from lorry_item_detail where lrry_no='" & txtlr3.Text & "'"
        cmd = New OleDbCommand(str, cn)
        da = New OleDbDataAdapter(cmd)
        Dim dta As New DataSet
        da.Fill(dta, "lorry_item_detail")
        griditem.DataSource = dta.Tables("lorry_item_detail")

    Else
        MsgBox("Connection Is Closed")
    End If
Catch ex As Exception

End Try


But by this code I know it will create a new datasource and create bound columns related to it. But how can I retrieve this data directly to unbound columns. How to assign datasource or like that to unbound columns?
Posted
Updated 22-Jul-10 23:45pm
v3

To manually bound the column , u need Eval("") function

Eg: Eval("CustmerID")

Cheers :)
 
Share this answer
 
Why do you want to use unbound columns?:confused: is it that you want to process the data before filling it in grid?
in that case access the dataset row by row...or simply use datareader...do your processing and then fill it in the grid by coding
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900