Imports System.Data.SQLite Public Class clsAllgemein Dim OptionTableAdapter As New LPDataSetTableAdapters.OptionenTableAdapter Dim lpdataset As New LP.LPDataSet Dim ReportTableAdapter As New LPDataSetTableAdapters.ReportTableAdapter Dim BerufTableadapter As New LPDataSetTableAdapters.BerufTableAdapter Dim SchuelerberufTableadatper As New LPDataSetTableAdapters.SchuelerBerufTableAdapter Dim SQLAbfrageTableAdapter As New LPDataSetTableAdapters.SQLAbfragenTableAdapter Public Function Get_Option(ByVal onr As Integer) As String Try OptionTableAdapter.FillByOptionNr(lpdataset.Optionen, onr) Dim option_tablerow As LPDataSet.OptionenRow option_tablerow = lpdataset.Optionen.Rows(0) Return option_tablerow.Inhalt Catch ex As Exception Return "" 'MsgBox(ex.Message) End Try End Function Public Function Set_Option(ByVal onr As Integer, Inhalt As String) As String Try Dim option_tablerow As LPDataSet.OptionenRow option_tablerow = lpdataset.Optionen.FindByOptionnr(onr) option_tablerow.Inhalt = Inhalt OptionTableAdapter.Update(lpdataset.Optionen) Catch ex As Exception MsgBox(ex.Message) End Try End Function Public Function Get_SQL_Statement(ByVal Reportnr As Integer) As String ReportTableAdapter.FillByReportNr(lpdataset.Report, Reportnr) Dim Report_tablerow As LPDataSet.ReportRow Report_tablerow = lpdataset.Report.Rows(0) Return Report_tablerow.SQL_Statement End Function Public Function Check_Beruf(ByVal berufnr As Integer) As Boolean BerufTableadapter.FillByBerufNr(lpdataset.Beruf, berufnr) Dim beruf_tablerow As LPDataSet.BerufRow If lpdataset.Beruf.Rows.Count < 1 Then Return False Else Return True End Function Public Function GetLastPrio(ByVal schuelernr As Integer) As Integer SchuelerberufTableadatper.FillBySchuelerPrio(lpdataset.SchuelerBeruf, schuelernr) Dim sb_tablerow As LPDataSet.SchuelerBerufRow If lpdataset.SchuelerBeruf.Rows.Count < 1 Then Return 0 Else sb_tablerow = lpdataset.SchuelerBeruf.Rows(0) Return sb_tablerow.Prioritaet End If End Function Public Function Get_SQLAbfrage_Statement(ByVal Statementnr As Integer) As String SQLAbfrageTableAdapter.FillBySQLNr(lpdataset.SQLAbfragen, Statementnr) Dim sqlrow As LPDataSet.SQLAbfragenRow sqlrow = lpdataset.SQLAbfragen.Rows(0) Return sqlrow.SQLScript End Function Public Function Get_Optionen() End Function Public Function GetNextKey(ByVal Tablename As String, ByVal fieldname As String) As Integer Dim SQLconnect As New SQLite.SQLiteConnection() SQLconnect.ConnectionString = Globals.Datenbank SQLconnect.Open() Dim ds As New DataSet Dim da As New SQLiteDataAdapter("", SQLconnect) Dim sqlcmd As New SQLiteCommand sqlcmd.Connection = SQLconnect sqlcmd.CommandType = CommandType.Text da.SelectCommand.CommandText = "Select * from " + Tablename + " order by " + fieldname + " desc" da.Fill(ds, "Daten") SQLconnect.Close() Dim key As Integer = 0 Try key = ds.Tables(0).Rows(0).Item(0) + 1 Catch key = 1 End Try SQLconnect = Nothing da.Dispose() sqlcmd.Dispose() Return key End Function End Class