How to view the result of select query from vb.net

  • Thread starter Thread starter syed javid ali
  • Start date Start date
S

syed javid ali

Guest
Hi,

I have created a code to select some columns from tables. But i dont know how to see the output in vb window itself. But when i run the code in SSMS i am able to see the results. But i wanted to see results in Vb window. How do i see it. Please help me out with this issue.

My code is as follows.


Imports System.Data.SqlClient
Public Class TJfailed
Dim dbname As String = "syed8"
Dim mycommand As New SqlCommand
Dim myConn2 As SqlConnection = New SqlConnection("Data Source=(local);Integrated Security=True;Initial Catalog=" & dbname & ";")

Public Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim qry As String
myConn2.Open()

qry = ("Select c.date_time FROM dbo.division_table AS j JOIN dbo.station_table AS m ON j.station_name = m.station_name JOIN dbo.bmu_table AS n ON m.tj_id = n.tj_id JOIN dbo.sensor_input_table AS c ON c.bmu_id=n.bmu_id")

mycommand = New SqlCommand(qry, myConn2)
mycommand.ExecuteNonQuery()
MessageBox.Show("Select completed")
MsgBox()
myConn2.Close()
End If
End Sub


End Class



Regards Syed

Continue reading...
 
Back
Top