Imports System.Reflection Public Class cUsersettings Property ChatEnabled As Boolean = True Property Username As String = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME Function GetParaMeterList() As List(Of SQLVariable) Dim List As New List(Of SQLVariable) List.Add(New SQLVariable("Username", Username)) List.Add(New SQLVariable("ChatEnabled", ChatEnabled)) Return List End Function Function save() Dim ds As New DataSet cSQL.SQL2DS("select * from tblUsersettings where Username = '" & Username & "'", ds) If ds.Tables(0).Rows.Count > 0 Then Dim update, where As String cSQL.getUpdateCmd(GetParaMeterList(), "Username", update, where) cSQL.UpdateSQL("dbo.tblusersettings", update, where) Else Dim insert As String cSQL.getInsertCmd(GetParaMeterList(), insert) cSQL.InsertSQL("dbo.tblusersettings", insert) End If End Function Function load() Dim ds As New DataSet cSQL.SQL2DS("select * from tblUsersettings where Username = '" & Username & "'", ds) If ds.Tables(0).Rows.Count > 0 Then For Each c As DataColumn In ds.Tables(0).Columns Dim propInfo As PropertyInfo = Me.GetType.GetProperty(c.ColumnName) If propInfo IsNot Nothing Then If Not IsDBNull(c.Table.Rows(0).Item(c)) Then propInfo.SetValue(Me, c.Table.Rows(0).Item(c)) End If End If Next End If End Function End Class