Dim strSql As String
strSql = " Select * from quazatoknitting where yarn_recchno= '" & txtchno.Text & "'"
Dim strSql1 As String
'strSql1 = " Select rec_qty from recfromknitting where yarn_recchno= '" & txtchno.Text & "'"
Dim da As New SqlDataAdapter(strSql + strSql1, objconnection)
Dim dt As New DataTable
da.Fill(dt)

If dt.Rows.Count > 0 Then
grd1.DataSource = dt
'Elsegrd1.DataSource = dt1
' MessageBox.Show("No records found ", "No Records Found", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

i am using above code to display multiple table records into datagrid but it was displaying only one table records(quazatoknitting)

Use Join in sql statement
E.g :

SELECT a.Id_User as 'User Id', a.Password, b.Id_Role, b.Status FROM USERS a join ROLE b on (a.Id_Role=b.Id_Role)

So you can remove strSql1 and just use strSql as sql statement.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.