954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Error in display multiple table record in datagrid

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)

dhanashreegd
Newbie Poster
10 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

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.

Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You