Imports System.Data.SqlClient Public Class cSQL Public Shared Sub SQL2DS(ByRef selector As String, ByRef ds As DataSet, Optional ByRef DBConnect As String = "") If DBConnect = "" Then DBConnect = Class1.DBConString Dim con As New SqlConnection Dim cmd As New SqlCommand con.ConnectionString = DBConnect 'Class1.DBConString cmd.Connection = con Try Dim dataadapter As New SqlDataAdapter(selector, con) con.Open() dataadapter.Fill(ds) con.Close() Catch ex As Exception 'MsgBox("hier") End Try End Sub Public Shared Sub UpdateSQL(ByRef table As String, ByRef values As String, ByRef where As String, Optional ByRef DBConnect As String = "") If DBConnect = "" Then DBConnect = Class1.DBConString Dim con As New SqlConnection Dim cmd As New SqlCommand con.ConnectionString = DBConnect ' Class1.DBConString cmd.Connection = con con.Open() cmd.CommandText = "UPDATE " & table & " SET " & values & " WHERE " & where & "" cmd.ExecuteNonQuery() con.Close() End Sub Public Shared Sub InsertSQL(ByRef table As String, ByRef insert As String, Optional ByRef DBConnect As String = "") If DBConnect = "" Then DBConnect = Class1.DBConString Dim con As New SqlConnection Dim cmd As New SqlCommand con.ConnectionString = DBConnect ' Class1.DBConString cmd.Connection = con con.Open() cmd.CommandText = "INSERT INTO " & table & " " & insert & "" cmd.ExecuteNonQuery() con.Close() End Sub Public Shared Sub DeleteSQL(ByRef table As String, ByRef where As String, Optional ByRef DBConnect As String = "") If DBConnect = "" Then DBConnect = Class1.DBConString Dim con As New SqlConnection Dim cmd As New SqlCommand con.ConnectionString = DBConnect ' Class1.DBConString cmd.Connection = con con.Open() cmd.CommandText = "DELETE FROM " & table & " WHERE " & where & "" cmd.ExecuteNonQuery() con.Close() End Sub Public Shared Sub SQLCommand(command As String, Optional ByRef DBConnect As String = "") If DBConnect = "" Then DBConnect = Class1.DBConString Dim con As New SqlConnection Dim cmd As New SqlCommand con.ConnectionString = DBConnect ' Class1.DBConString cmd.Connection = con con.Open() cmd.CommandText = command cmd.ExecuteNonQuery() con.Close() End Sub End Class Public Class SQLVariable Private Text, Value As String Private prim As Boolean Public Sub New(ByVal btext As String, ByVal bvalue As String, Optional bprim As Boolean = False) Me.Value = bvalue Me.Text = btext End Sub Public ReadOnly Property SQLText() As String Get Return Text End Get End Property Public ReadOnly Property SQLValue() As Object Get Return value End Get End Property End Class