110 lines
3.7 KiB
Plaintext
110 lines
3.7 KiB
Plaintext
Imports System.Data.SQLite
|
|
Imports FastReport
|
|
Imports FastReport.Data
|
|
Imports FastReport.Preview
|
|
Imports FastReport.Utils
|
|
Imports System.Data
|
|
|
|
|
|
|
|
Public Class frmReportview
|
|
Dim splitter() As String
|
|
|
|
Dim freport As New Report
|
|
Dim ReportNr As Integer
|
|
Dim Design As Boolean
|
|
Sub New()
|
|
InitializeComponent()
|
|
End Sub
|
|
|
|
Sub New(ByVal Reportnr As Integer, ByVal design As Boolean, ByVal Titel As String)
|
|
InitializeComponent()
|
|
Me.ReportNr = Reportnr
|
|
Me.Design = design
|
|
Me.Text = "Auswertung " + Titel
|
|
End Sub
|
|
|
|
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
|
Dim allg As New clsAllgemein
|
|
Dim dms As New DocMgMt
|
|
Dim Path As String = allg.Get_Option(1)
|
|
|
|
Dim sql As String = allg.Get_SQL_Statement(Me.ReportNr)
|
|
If sql.Substring(0, 1) = "[" Then
|
|
sql = sql.Replace("[", "")
|
|
sql = sql.Replace("]", "")
|
|
sql = allg.Get_SQLAbfrage_Statement(sql)
|
|
End If
|
|
|
|
Dim ds As New DataSet
|
|
|
|
splitter = sql.Split("//SQL//")
|
|
Dim SQLconnect As New SQLite.SQLiteConnection()
|
|
SQLconnect.ConnectionString = My.Settings.LPConnectionString & ";"
|
|
SQLconnect.Open()
|
|
Dim da As New SQLiteDataAdapter("", SQLconnect)
|
|
Dim sqlcmd As New SQLiteCommand
|
|
sqlcmd.Connection = SQLconnect
|
|
sqlcmd.CommandType = CommandType.Text
|
|
|
|
If splitter.Length > 1 Then
|
|
Dim i As Integer
|
|
For i = 0 To splitter.Length - 1
|
|
If splitter(i).ToString.Length > 10 Then
|
|
sqlcmd.CommandText = splitter(i)
|
|
da.SelectCommand = sqlcmd
|
|
Try
|
|
If i = 0 Then
|
|
da.Fill(ds, "Daten")
|
|
Else
|
|
da.Fill(ds, "Daten_" + i.ToString)
|
|
End If
|
|
Catch ex As Exception
|
|
End Try
|
|
End If
|
|
Next
|
|
Else
|
|
sqlcmd.CommandText = sql
|
|
da.SelectCommand = sqlcmd
|
|
da.Fill(ds, "Daten")
|
|
End If
|
|
sqlcmd.Dispose()
|
|
SQLconnect.Close()
|
|
Dim filename As String = dms.Get_RptDatei(Me.ReportNr)
|
|
Dim selectFirst As Boolean = False
|
|
'Dim ds As New DataSet
|
|
'Dim SQLconnect As New SQLite.SQLiteConnection()
|
|
'SQLconnect.ConnectionString = My.Settings.LPConnectionString & ";"
|
|
'SQLconnect.Open()
|
|
'Dim da As New SQLiteDataAdapter("", SQLconnect)
|
|
'Dim sqlcmd As New SQLiteCommand
|
|
'sqlcmd.Connection = SQLconnect
|
|
'sqlcmd.CommandType = CommandType.Text
|
|
'sqlcmd.CommandText = sql
|
|
'da.SelectCommand = sqlcmd
|
|
'da.Fill(ds, "Daten")
|
|
'sqlcmd.Dispose()
|
|
'SQLconnect.Close()
|
|
Me.freport.Preview = Me.previewControl1
|
|
freport.Load(filename)
|
|
freport.RegisterData(ds)
|
|
If splitter.Length > 1 Then
|
|
Dim i As Integer
|
|
For i = 0 To splitter.Length - 1
|
|
If splitter(i).ToString.Length > 10 Then
|
|
If i = 0 Then
|
|
freport.GetDataSource("Daten").Enabled = True
|
|
Else
|
|
freport.GetDataSource("Daten_" + i.ToString).Enabled = True
|
|
End If
|
|
End If
|
|
Next
|
|
Else
|
|
freport.GetDataSource("Daten").Enabled = True
|
|
End If
|
|
freport.SetParameterValue("Parcours", allg.Get_Option(2))
|
|
freport.SetParameterValue("Spruch", allg.Get_Option(3))
|
|
freport.GetDataSource("Daten").Enabled = True
|
|
freport.Show()
|
|
End Sub
|
|
End Class |