Beginn dbConnection
This commit is contained in:
@@ -59,7 +59,6 @@ internal class Customer
|
||||
{
|
||||
builder.Append($"{Constants.Separator} {phoneNumber.AreaCode} {phoneNumber.Number}");
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
}
|
@@ -11,7 +11,6 @@ while (string.IsNullOrEmpty(filePath))
|
||||
|
||||
if (filePath.StartsWith('\"'))
|
||||
{
|
||||
|
||||
filePath = filePath.Substring(startIndex: 1, length: filePath.Length - 1);
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
{
|
||||
|
||||
}
|
@@ -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")]
|
||||
|
@@ -1 +1 @@
|
||||
ca49067a20f82534e6f4dc92655af77866e882ae8f80b03ea3f9bd23828f8614
|
||||
9c166b10907dc4b5eb71f19b5658d875cd05601f289a7fc5eb6bb564b59f3775
|
||||
|
Reference in New Issue
Block a user