report

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

Imports System.Data.

SqlClient
Public Class Form1
Public con As New SqlConnection("Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=helpppppp;Data Source=DESKTOP-A5IN5U9\SQLEXPRESS")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
If con.State = ConnectionState.Closed Then con.Open()
Dim cmd As New SqlCommand("select * from helpe22 where id=" &
Val(TextBox1.Text), con)
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable
dt.Clear()
da.Fill(dt)
If da.Fill(dt) = Nothing Then
MsgBox("������")
Exit Sub
End If
Dim rpt As New CrystalReport1
rpt.SetDataSource(dt)
Dim f As New Form1
f.CrystalReportViewer1.ReportSource = rpt
f.ShowDialog()
End Sub
End Class

You might also like