SQLLite'yi öğrenmem iyi oldu kodlarını buldum tamamdır ama gelelim asıl sorunumuza crystal repottaki problemi nasıl çözerim bilgileri projedeki datasetten yükleyince .rpt formumda bilgilerle dolmuyor ama tasarımcıda önizlemede herşey görünüyor sorun yokmuş gibi ama uygulamada boş bir form çıkıyor doğrudan .mdb dosyasından bilgileri yükleyince herşey çalışıyor ama bu seferde .mdb dosyası program hangi bilgisayara kurulursa kurulsun herzaman aynı konumda olmak zorunda buda kabul edilebilir birşey değil.
Bu iş için aşağıdaki kodu buldum bu benim işimi görür diye düşünüyorum ama SetupReport fonksiyonunu bir türlü ayarlayamadım birsürü tanımsız değişken hatası veriyor bir inceleyebilirmisiniz
Kodun Kaynağı =
http://www.webdeveloper.com/forum/showthread.php?t=200791Alternatif bir kaynak daha =
http://snippets.dzone.com/posts/show/4029
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CrystalReportViewer1.ReportSource = "ZTab.rpt"
CrystalReportViewer1.Zoom(1)
End Sub
Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRunNow.Click
CrystalReportViewer1.ReportSource = combobox1.SelectedItem
CrystalReportViewer1.Zoom(1)
End Sub
Dim myreport As New ReportDocument
Dim strDSN As System.String
Dim strDB As System.String
Dim strUID As System.String
Dim strPWD As System.String
Private Sub frmMain_Load(ByVal sender........
CrystalReportViewer1.ReportSource = "ZTab.rpt"
End Sub
Private Sub btnChangeDataBase_Click(ByVal sender ........
strNewPath = "C:\Projects\Employee.mdb"
myreport.Load("ZTab.rpt")
SetupReport(myreport)
End Sub
Private Function SetupReport(ByRef objCrystalReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument) As System.Boolean
Dim crTableLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database
Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
Dim aTable As CrystalDecisions.CrystalReports.Engine.Table
Dim bTable As CrystalDecisions.CrystalReports.Engine.Table
Dim blnTest As System.Boolean
Dim strLocation As System.String
crDatabase = objCrystalReportDocument.Database
crTables = crDatabase.Tables
For Each aTable In crTables
crTableLogOnInfo = aTable.LogOnInfo
strDSN = crTableLogOnInfo.ConnectionInfo.ServerName
strDB = crTableLogOnInfo.ConnectionInfo.DatabaseName
strUID = crTableLogOnInfo.ConnectionInfo.UserID
strPWD = crTableLogOnInfo.ConnectionInfo.Password
OutputDebugLine("BEFORE")
OutputDebugLine("TABLE NAME: " & aTable.Name)
OutputDebugLine("TABLE LOC: " & aTable.Location)
OutputDebugLine("SERVER: " & strDSN)
OutputDebugLine("DB: " & strDB)
OutputDebugLine("UID: " & strUID)
OutputDebugLine("PWD: " & strPWD)
OutputDebugLine("REPORT NAME: " & crTableLogOnInfo.ReportName)
OutputDebugLine("Table Name: " & crTableLogOnInfo.TableName)
aTable.ApplyLogOnInfo(crTableLogOnInfo)
strLocation = strNewPath 'pass new mdb name
OutputDebugLine("New Location: " & strLocation)
Try
aTable.Location = strLocation
Catch ex As Exception
OutputDebugLine("Set Location Error: " & ex.ToString)
End Try
OutputDebugLine("AFTER")
OutputDebugLine("TABLE NAME: " & aTable.Name)
OutputDebugLine("TABLE LOC: " & aTable.Location)
OutputDebugLine("SERVER: " & strDSN)
OutputDebugLine("DB: " & strDB)
OutputDebugLine("UID: " & strUID)
OutputDebugLine("PWD: " & strPWD)
OutputDebugLine("REPORT NAME: " & crTableLogOnInfo.ReportName)
OutputDebugLine("Table Name: " & crTableLogOnInfo.TableName)
Try
blnTest = aTable.TestConnectivity()
OutputDebugLine("CONNECTED? " & blnTest.ToString())
Catch ex As Exception
OutputDebugLine("CONNECTED? NO")
OutputDebugLine(ex.ToString)
End Try
Next aTable
myWrite.Close()
myWrite = Nothing
myFile = Nothing
CrystalReportViewer1.ReportSource = myreport
End Function