Dear Sir,
Datagridview1 has three columns as
S.No-------Porducts--------Price
When I enter s.no in column1 then product name and price must display in relevant columns as
S.No-------Porducts--------Price
1------------Mango---------12
I wrote folloiwng codes as example
Please help
Datagridview1 has three columns as
S.No-------Porducts--------Price
When I enter s.no in column1 then product name and price must display in relevant columns as
S.No-------Porducts--------Price
1------------Mango---------12
I wrote folloiwng codes as example
Please help
VB.NET:
str = "SELECT * FROM products where sno =" & Val(DataGridView1.Rows(1).Cells(0).Value)
cmd = New SqlClient.SqlCommand(str, con)
da = New SqlClient.SqlDataAdapter(cmd)
dt = New DataTable
da.Fill(dt)
If dt.Rows.Count > 0 Then
DataGridView1.Rows(1).Cells(2).Value = Val(dt.Rows(1).Item(0))
DataGridView1.Rows(1).Cells(3).Value = Val(dt.Rows(1).Item(1))
end if
Last edited: