From 9b4f200684e45e0079462c1bb3b203190f71a83f Mon Sep 17 00:00:00 2001 From: ms Date: Thu, 12 Jan 2023 09:30:46 +0100 Subject: [PATCH] =?UTF-8?q?SQL=20Update=20und=20Kopie=20nach=20Suben=20f?= =?UTF-8?q?=C3=BCr=20Bestellungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FTPUpload/FTPUpload.vbproj | 6 ++++++ FTPUpload/Form1.Designer.vb | 12 ++++++++++++ FTPUpload/Form1.vb | 25 +++++++++++++++++++++++++ Gastro/My Project/app.manifest | 0 Gastro/My Project/licenses.licx | 5 ----- Gastro/cListe.vb | 4 +++- Gastro/cSQL.vb | 12 ++++++++++++ Gastro/start.ini | 2 +- 8 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 Gastro/My Project/app.manifest diff --git a/FTPUpload/FTPUpload.vbproj b/FTPUpload/FTPUpload.vbproj index 294b4e4..49b9e19 100644 --- a/FTPUpload/FTPUpload.vbproj +++ b/FTPUpload/FTPUpload.vbproj @@ -120,5 +120,11 @@ + + + {16c34998-6fc9-42af-a84e-febe93cce003} + Gastro + + \ No newline at end of file diff --git a/FTPUpload/Form1.Designer.vb b/FTPUpload/Form1.Designer.vb index a4a8bad..0244ed9 100644 --- a/FTPUpload/Form1.Designer.vb +++ b/FTPUpload/Form1.Designer.vb @@ -24,6 +24,7 @@ Partial Class Form1 Private Sub InitializeComponent() Me.btnUpload = New System.Windows.Forms.Button() Me.bntUploadAndClose = New System.Windows.Forms.Button() + Me.Button1 = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'btnUpload @@ -44,11 +45,21 @@ Partial Class Form1 Me.bntUploadAndClose.Text = "Do it and Close !" Me.bntUploadAndClose.UseVisualStyleBackColor = True ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(363, 214) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(75, 23) + Me.Button1.TabIndex = 2 + Me.Button1.Text = "Do SQL!" + Me.Button1.UseVisualStyleBackColor = True + ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.bntUploadAndClose) Me.Controls.Add(Me.btnUpload) Me.Name = "Form1" @@ -59,4 +70,5 @@ Partial Class Form1 Friend WithEvents btnUpload As Button Friend WithEvents bntUploadAndClose As Button + Friend WithEvents Button1 As Button End Class diff --git a/FTPUpload/Form1.vb b/FTPUpload/Form1.vb index 626522d..99a0341 100644 --- a/FTPUpload/Form1.vb +++ b/FTPUpload/Form1.vb @@ -121,12 +121,32 @@ Public Class Form1 ' MsgBox("p") Silent = True bntUploadAndClose.PerformClick() + Case "/sql" + Silent = True + sqlsendinator() End Select Next End Sub + Public Function sqlsendinator() + Gastro.cListe.selectDBConnection("SQLGuide01") + Dim sql As New Gastro.cSQL + + Dim Upload2SQLGuide As String = "INSERT INTO [SQLGUIDE01.verag.ost.dmn].[AVISO].dbo.[tblEBMenu] +Select * from [192.168.2.17].[Gastro].dbo.[GMenu] as table1 +WHERE NOT EXISTS ( + select * from [SQLGUIDE01.verag.ost.dmn].[AVISO].dbo.[tblEBMenu] as table2 WHERE table1.MenuTitel = table2.MenuTitel AND table1.[MenuDateVon] = table2.[MenuDateVon] +) +" + + sql.SqlQuery(Upload2SQLGuide) + + Close() + + End Function + Public Function sendMail(subject As String, body As String) Try Dim Smtp_Server As New SmtpClient @@ -152,4 +172,9 @@ Public Class Form1 MsgBox(error_t.ToString) End Try End Function + + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + sqlsendinator() + + End Sub End Class diff --git a/Gastro/My Project/app.manifest b/Gastro/My Project/app.manifest new file mode 100644 index 0000000..e69de29 diff --git a/Gastro/My Project/licenses.licx b/Gastro/My Project/licenses.licx index 0b7df2f..e69de29 100644 --- a/Gastro/My Project/licenses.licx +++ b/Gastro/My Project/licenses.licx @@ -1,5 +0,0 @@ -GrapeCity.ActiveReports.SectionReport, GrapeCity.ActiveReports.v12, Version=12.2.13986.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff -GrapeCity.ActiveReports.SectionReport, GrapeCity.ActiveReports.v9, Version=9.1.2302.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff -GrapeCity.ActiveReports.Viewer.Win.Viewer, GrapeCity.ActiveReports.Viewer.Win.v12, Version=12.2.13986.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff -GrapeCity.ActiveReports.Viewer.Win.Viewer, GrapeCity.ActiveReports.Viewer.Win.v9, Version=9.1.2302.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff -GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport, GrapeCity.ActiveReports.Export.Pdf.v12, Version=12.2.13986.0, Culture=neutral, PublicKeyToken=cc4967777c49a3ff diff --git a/Gastro/cListe.vb b/Gastro/cListe.vb index e3182bb..db208bc 100644 --- a/Gastro/cListe.vb +++ b/Gastro/cListe.vb @@ -17,10 +17,12 @@ Select Case connection Case "Debug" - DBConnectionString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Gastro;User ID=sa;Password=BmWr501956;Connection Timeout=5;" + DBConnectionString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Initial Catalog=Gastro;User ID=sa;Password=+ibidTsu2303!;Connection Timeout=5;" Debug = True Case "Highway" DBConnectionString = "Server=YM5T001348;Initial Catalog=Gastro;User ID=sa;Password=BmWr501956;Connection Timeout=5;" + Case "SQLGuide01" + DBConnectionString = "Server=SQLGUIDE01.verag.ost.dmn;Initial Catalog=AVISO;User ID=sa;Password=BmWr501956;Connection Timeout=5;" End Select End Function diff --git a/Gastro/cSQL.vb b/Gastro/cSQL.vb index 91c6346..3666dad 100644 --- a/Gastro/cSQL.vb +++ b/Gastro/cSQL.vb @@ -50,6 +50,18 @@ Public Class cSQL con.Close() End Sub + Public Shared Sub SqlQuery(ByRef query As String) + Dim con As New SqlConnection + Dim cmd As New SqlCommand + con.ConnectionString = cListe.DBConnectionString + cmd.Connection = con + + con.Open() + cmd.CommandText = query + cmd.ExecuteNonQuery() + con.Close() + End Sub + End Class diff --git a/Gastro/start.ini b/Gastro/start.ini index cf8272d..751f437 100644 --- a/Gastro/start.ini +++ b/Gastro/start.ini @@ -2,7 +2,7 @@ Spaltenname;Wert; -DBConnection;Debug;--------------------------------------------------------Debug oder Highway; +DBConnection;Highway;--------------------------------------------------------Debug oder Highway; PDFUploadPath;\\192.168.0.253\backup\temp_Sebastian\gastro\;----------------Pfad für PDF Upload; MenuDetail1;Tagesgericht: 6,50 EUR;--------------------------------------------MenuDetail1 MenuDetail2;Beilagensalat: 3,50 EUR;--------------------------------------------MenuDetail2