Thank U Sir,
Sir, as I see that we can create using Crystal Report and download the report as PDF directly but it has also a con that it stops by and by saying maximum limit over.
Private Sub printform2()
Dim connectionString, sql As String
Dim connection As SqlConnection
Dim reportdocument As New ReportDocument()
reportdocument.Load(Server.MapPath("form2.rpt"))
Using dsdeo As New dutylist()
connectionString = ConfigurationManager.ConnectionStrings("accountsConnectionString").ToString
connection = New SqlConnection(connectionString)
' Using con As New SqlConnection("Data Source=SureshDasari;Integrated Security=true;Initial Catalog=MySampleDB")
connection.Open()
'Dim cmd As New SqlCommand
sql = "select a.centcode,a.name,a.duty,a.dutydays,b.centname as centname,b.students as students from centduty24 a left join centmast24 b on a.centcode=b.centcode where a.centcode=" & lblcentcode.Text & ""
Using cmd As New SqlCommand(sql, connection)
''("select a.centcode,a.name,a.duty,a.dutydays,b.centname as centname,b.students as students from centduty24 a left join centmast24 b on a.centcode=b.centcode where a.centcode=" & lblcentcode.Text & "", connection)
Using da As New SqlDataAdapter(cmd)
da.Fill(dsdeo, "centduty24")
connection.Close()
'End Using
Using examreport As New ReportDocument()
examreport.Load(Server.MapPath("form2.rpt"))
examreport.SetDataSource(dsdeo.Tables("centduty24"))
examreport.SetDataSource(dsdeo)
examreport.ExportToHttpResponse(CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat, Response, True, "form2")
examreport.Close()
examreport.Dispose()
GC.Collect()
End Using
End Using
End Using
End Using
End Sub