Beginn dbConnection

This commit is contained in:
Jan Conze 2024-08-28 08:55:39 +02:00
parent ebcc615de4
commit aeb2707699
8 changed files with 85 additions and 31 deletions

View File

@ -2,18 +2,18 @@
"Version": 1,
"WorkspaceRootPath": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|c:\\jan_bib_module\\pmc\\projekt\\projekt_calcan_conze\\projekt_calcan_conze\\repository\\dbconnection.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|solutionrelative:projekt_calcan_conze\\repository\\dbconnection.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|c:\\jan_bib_module\\pmc\\projekt\\projekt_calcan_conze\\projekt_calcan_conze\\import.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|solutionrelative:projekt_calcan_conze\\import.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|c:\\jan_bib_module\\pmc\\projekt\\projekt_calcan_conze\\projekt_calcan_conze\\programm.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|solutionrelative:projekt_calcan_conze\\programm.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|c:\\jan_bib_module\\pmc\\projekt\\projekt_calcan_conze\\projekt_calcan_conze\\dtos\\customerdto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|solutionrelative:projekt_calcan_conze\\dtos\\customerdto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|c:\\jan_bib_module\\pmc\\projekt\\projekt_calcan_conze\\projekt_calcan_conze\\dtos\\customerattributedto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|solutionrelative:projekt_calcan_conze\\dtos\\customerattributedto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|c:\\jan_bib_module\\pmc\\projekt\\projekt_calcan_conze\\projekt_calcan_conze\\models\\customer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|solutionrelative:projekt_calcan_conze\\models\\customer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
@ -27,8 +27,12 @@
"RelativeMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|solutionrelative:projekt_calcan_conze\\constants.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|c:\\jan_bib_module\\pmc\\projekt\\projekt_calcan_conze\\projekt_calcan_conze\\import.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|solutionrelative:projekt_calcan_conze\\import.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
"AbsoluteMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|c:\\jan_bib_module\\pmc\\projekt\\projekt_calcan_conze\\projekt_calcan_conze\\dtos\\customerdto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|solutionrelative:projekt_calcan_conze\\dtos\\customerdto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|c:\\jan_bib_module\\pmc\\projekt\\projekt_calcan_conze\\projekt_calcan_conze\\dtos\\customerattributedto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|solutionrelative:projekt_calcan_conze\\dtos\\customerattributedto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{44DD7752-6BB5-4C3A-9053-671D8ADE49C4}|Projekt_Calcan_Conze\\Projekt_Calcan_Conze.csproj|c:\\jan_bib_module\\pmc\\projekt\\projekt_calcan_conze\\projekt_calcan_conze\\models\\phonenumber.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
@ -42,34 +46,47 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 0,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"DocumentIndex": 2,
"Title": "Programm.cs",
"DocumentMoniker": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\Projekt_Calcan_Conze\\Programm.cs",
"RelativeDocumentMoniker": "Projekt_Calcan_Conze\\Programm.cs",
"ToolTip": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\Projekt_Calcan_Conze\\Programm.cs",
"RelativeToolTip": "Projekt_Calcan_Conze\\Programm.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAABAAAAAAAAAA==",
"ViewState": "AgIAAAkAAAAAAAAAAAAAACcAAAAUAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-23T08:36:46.981Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 6,
"DocumentIndex": 1,
"Title": "Import.cs",
"DocumentMoniker": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\Projekt_Calcan_Conze\\Import.cs",
"RelativeDocumentMoniker": "Projekt_Calcan_Conze\\Import.cs",
"ToolTip": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\Projekt_Calcan_Conze\\Import.cs",
"RelativeToolTip": "Projekt_Calcan_Conze\\Import.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAcAAAAAAAAAAAAAAA==",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAHQAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-26T06:25:21.455Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "dbConnection.cs",
"DocumentMoniker": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\Projekt_Calcan_Conze\\Repository\\dbConnection.cs",
"RelativeDocumentMoniker": "Projekt_Calcan_Conze\\Repository\\dbConnection.cs",
"ToolTip": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\Projekt_Calcan_Conze\\Repository\\dbConnection.cs",
"RelativeToolTip": "Projekt_Calcan_Conze\\Repository\\dbConnection.cs",
"ViewState": "AgIAABIAAAAAAAAAAAAAACIAAAArAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-27T08:20:43.501Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
@ -80,8 +97,7 @@
"RelativeToolTip": "Projekt_Calcan_Conze\\Constants.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAcAAAA/AAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-26T06:25:15.786Z",
"EditorCaption": ""
"WhenOpened": "2024-08-26T06:25:15.786Z"
},
{
"$type": "Document",
@ -93,8 +109,7 @@
"RelativeToolTip": "Projekt_Calcan_Conze\\Models\\Address.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-26T06:25:38.242Z",
"EditorCaption": ""
"WhenOpened": "2024-08-26T06:25:38.242Z"
},
{
"$type": "Document",
@ -104,14 +119,14 @@
"RelativeDocumentMoniker": "Projekt_Calcan_Conze\\Models\\Customer.cs",
"ToolTip": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\Projekt_Calcan_Conze\\Models\\Customer.cs",
"RelativeToolTip": "Projekt_Calcan_Conze\\Models\\Customer.cs",
"ViewState": "AgIAACcAAAAAAAAAAAAywAQAAAAAAAAAAAAAAA==",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAAZAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-26T06:25:37.24Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"DocumentIndex": 7,
"Title": "CustomerAttributeDto.cs",
"DocumentMoniker": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\Projekt_Calcan_Conze\\DTOs\\CustomerAttributeDto.cs",
"RelativeDocumentMoniker": "Projekt_Calcan_Conze\\DTOs\\CustomerAttributeDto.cs",
@ -119,12 +134,11 @@
"RelativeToolTip": "Projekt_Calcan_Conze\\DTOs\\CustomerAttributeDto.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAQAAAAzAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-26T06:25:41.319Z",
"EditorCaption": ""
"WhenOpened": "2024-08-26T06:25:41.319Z"
},
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 6,
"Title": "CustomerDto.cs",
"DocumentMoniker": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\Projekt_Calcan_Conze\\DTOs\\CustomerDto.cs",
"RelativeDocumentMoniker": "Projekt_Calcan_Conze\\DTOs\\CustomerDto.cs",
@ -132,12 +146,11 @@
"RelativeToolTip": "Projekt_Calcan_Conze\\DTOs\\CustomerDto.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAIAAAAVAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-08-26T06:25:42.556Z",
"EditorCaption": ""
"WhenOpened": "2024-08-26T06:25:42.556Z"
},
{
"$type": "Document",
"DocumentIndex": 7,
"DocumentIndex": 8,
"Title": "PhoneNumber.cs",
"DocumentMoniker": "C:\\Jan_bib_Module\\PMC\\Projekt\\Projekt_Calcan_Conze\\Projekt_Calcan_Conze\\Models\\PhoneNumber.cs",
"RelativeDocumentMoniker": "Projekt_Calcan_Conze\\Models\\PhoneNumber.cs",

View File

@ -59,7 +59,6 @@ internal class Customer
{
builder.Append($"{Constants.Separator} {phoneNumber.AreaCode} {phoneNumber.Number}");
}
return builder.ToString();
}
}

View File

@ -11,7 +11,6 @@ while (string.IsNullOrEmpty(filePath))
if (filePath.StartsWith('\"'))
{
filePath = filePath.Substring(startIndex: 1, length: filePath.Length - 1);
}

View File

@ -0,0 +1,43 @@
namespace Project_Calcan_Conze;
using MySql.Data;
using MySql.Data.MySqlClient;
using MySqlX.XDevAPI;
using System.Data.Common;
using System.Reflection.PortableExecutable;
using System.Xml;
MySql.Data.MySqlClient.MySqlConnection myConnection;
string myConnectionString;
//set the correct values for your server, user, password and database name
myConnectionString = "server=localhost;uid=root;pwd=root;database=vr_contact";
try
{
myConnection = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);
//open a connection
myConnection.Open();
// create a MySQL command and set the SQL statement with parameters
MySqlCommand myCommand = new MySqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandText = @"SELECT * FROM workshop WHERE maxParticipants = @code;";
myCommand.Parameters.AddWithValue("@code", "12");
// execute the command and read the results
using MySqlDataReader myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
int id = myReader.GetInt32("maxParticipants");
string name = myReader.GetString("title");
Console.WriteLine(id + " " + name);
}
myConnection.Close();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
}

View File

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Projekt_Calcan_Conze")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+26c62d000d0e4ffd1f3c6baf8a522f5b891e50dc")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ebcc615de4c72eb9d786776bf6bd0ceb5640648c")]
[assembly: System.Reflection.AssemblyProductAttribute("Projekt_Calcan_Conze")]
[assembly: System.Reflection.AssemblyTitleAttribute("Projekt_Calcan_Conze")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
ca49067a20f82534e6f4dc92655af77866e882ae8f80b03ea3f9bd23828f8614
9c166b10907dc4b5eb71f19b5658d875cd05601f289a7fc5eb6bb564b59f3775