0

Dear freinds i want to get specific data in gridview specifc cell with the help of sql query from sql table

i put the following query but it doesn't work

Sql = "select e.item_no from nitmtbl e,purchaseitem g where e.item_name=g.item_name and g.item_name='grovita sp'"
        Da = New SqlDataAdapter(Sql, Class1.Connection)
        Da.SelectCommand.ExecuteNonQuery()
        Dim ds As New DataSet
        Da.Fill(ds, "nitmtbl")
        DataGridView1.Rows(0).Cells(0).Value = ds.Tables("nitmtbl")

kindly help me

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by like_bilal02
0
Sql = "select e.item_no from nitmtbl e,purchaseitem g where e.item_name=g.item_name and g.item_name='grovita sp'"

Da = New SqlDataAdapter(Sql, Class1.Connection)

Dim dt As New DataTable
Da.Fill(dt)
DataGridView1.DataSource=dt
0

yr this query give error in DT

error is: Variable "dt"is used before it has assigned a null value

and 1 more thing i want to explain i want that vakue come from table in a way that when i make any entry in datagrid view and when i put a item name in datagrid 2 cell the 1st cell value come automatically with the help of above query query

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.