View: 2931|Reply: 8
|
tutup connection crystal report dlm asp.net - vb.net
[Copy link]
|
|
aku dah mati akal...tak tau camana nak tutup connection yg dibuka oleh crystal report.
Aku buat code utk convert dari format crystal report ke pdf....code tu jadik, tapi masalahnya connection yg dicreate oleh crystal report tu tak boleh tutup. Nie code yg aku buat :-
Dim crLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim rptSource As New ReportDocument
Dim a As String
'Stop buffering the response
Response.Buffer = False
'Clear the response content and headers
Response.ClearContent()
Response.ClearHeaders()
'Response.Write(Server.MapPath("prtmyiKEWtry.rpt"))
'a = Server.MapPath
rptSource.Load(Server.MapPath("prtmyiKEW.rpt"))
crLogonInfo = rptSource.Database.Tables(0).LogOnInfo
crLogonInfo.ConnectionInfo.ServerName = "*****"
crLogonInfo.ConnectionInfo.UserID = "****"
crLogonInfo.ConnectionInfo.Password = "****"
crLogonInfo.ConnectionInfo.DatabaseName = "****"
rptSource.Database.Tables(0).ApplyLogOnInfo(crLogonInfo)
rptSource.Refresh()
rptSource.SetParameterValue(UCase("sElmCode"), "*****"))
rptSource.SetParameterValue(UCase("sStartDate"), "26/01/2009")
rptSource.SetParameterValue(UCase("sEndDate"), "26/01/2009")
rptSource.SetParameterValue(UCase("sIC"), "*****") 'CStr(info(0)))
rptSource.SetParameterValue(UCase("sName"), "Ahmad")
rptSource.SetParameterValue(UCase("sNoStaf"), "Ahmad")
rptSource.SetParameterValue(UCase("sPTJ"), "Ahmad")
rptSource.SetParameterValue(UCase("sBankName"), "Ahmad") 'info(4))
rptSource.SetParameterValue(UCase("sAccNo"), "Ahmad") 'CStr(info(5)))
rptSource.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "Customers")
rptSource.Dispose()
rptSource.DataSourceConnections.Clear()
GC.Collect()
GC.WaitForPendingFinalizers()
tlg advice...
tq |
|
|
|
|
|
|
|
ko xbuat pon path filedestinationoption.. imports crystaldecisions.shared...
response ????
response.charset =""
response.writefile(crDiskFileDestinationOptions.DiskFileName)
response.flush()
response.close()
tp btol ke coding atas tuh jd bila eksport..... errorr kuar apa tuh..... aku xtahu kikiki..... |
|
|
|
|
|
|
|
naikAntena..
code tu jadik...tapi bila aku tgk kat processes dlm sybase admin, ada crystal tu tak close connection tu. bayangkan kalo 1000 org akses page aku tu, so maknanya 1000 conn yg akan dicreate.
arghhh tension...skang nie tepaksala user print form je la dulu sampai aku boleh solve prob tu. |
|
|
|
|
|
|
|
Balas #5 aks_berhad\ catat
hahahahaha... mcm2 ko nih.. besa arr tuh.. selalunyaa apa yg kita siap buat mengundang lebih banyak request ngan problemm... kuikui.. saborr je larrr.... |
|
|
|
|
|
|
|
yeah...aku da dapat solution utk masalah tu...aku guna dataset.
so connection yg dibukak kat sybase cuma 1 conn shj.....
sekian...case closed |
|
|
|
|
|
|
|
nk wat setFocus() camner ek..asal ak nye x jd... |
|
|
|
|
|
|
|
set focus?
tu function dlm apa? dataset? |
|
|
|
|
|
|
| |
|