Akama Aka
Akama Aka
Explore posts from servers
CC#
Created by Akama Aka on 10/1/2024 in #help
No secure hashing method?
Hello, I got an assignment from school to save plain text passwords as a encrypted password in C#. I have looked at the following pages: https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/consumer-apis/password-hashing?view=aspnetcore-8.0 https://andrewlock.net/exploring-the-asp-net-core-identity-passwordhasher/ And I'm rn so fuqing impressed what a piece of shiq language C# is. Is there fr no by default implemented method to securely hash Passwords?
84 replies
CC#
Created by Akama Aka on 2/19/2024 in #help
Windows Worker Service times out
Hello. Everytime I want to start my Worker Service I get the message that it doesnt reacted in time and I dont know why I get this error. because everytime I run the exe noremally the whole thing works. Program.cs
using My_Service;

HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Services.AddHostedService<Worker>();
IHost host = builder.Build();
await host.RunAsync();
using My_Service;

HostApplicationBuilder builder = Host.CreateApplicationBuilder(args);
builder.Services.AddHostedService<Worker>();
IHost host = builder.Build();
await host.RunAsync();
Worker.cs
using System.Net.Mime;

namespace My_Service;


public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;

public Worker(ILogger<Worker> logger)
{
_logger = logger;
}



protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{

while (!stoppingToken.IsCancellationRequested)
{
_logger.LogInformation("My Service running at: {time}", DateTimeOffset.Now);
try
{
myServiceCode.systemcode();
_logger.LogInformation("Started Service Service Code");
//await Task.Delay(1_000, stoppingToken);
}
catch (Exception e)
{
_logger.LogError("Error in Service Code: {e}", e);
}
await Task.Delay(60000, stoppingToken);
}
}
}
using System.Net.Mime;

namespace My_Service;


public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;

public Worker(ILogger<Worker> logger)
{
_logger = logger;
}



protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{

while (!stoppingToken.IsCancellationRequested)
{
_logger.LogInformation("My Service running at: {time}", DateTimeOffset.Now);
try
{
myServiceCode.systemcode();
_logger.LogInformation("Started Service Service Code");
//await Task.Delay(1_000, stoppingToken);
}
catch (Exception e)
{
_logger.LogError("Error in Service Code: {e}", e);
}
await Task.Delay(60000, stoppingToken);
}
}
}
144 replies
CC#
Created by Akama Aka on 12/7/2023 in #help
Update DataGridView in Winforms doesnt work
No description
4 replies
CC#
Created by Akama Aka on 12/6/2023 in #help
Incorrect syntax near '@address_id'
Hello, I'm currently working on a School project and I want to insert something into the Database but I get everytime a error that says that a incorrect syntax was given that doesnt really makes any sense for me. Code:
SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\....\\Database.mdf;Integrated Security=True;Connect Timeout=30");
con.Open();
SqlCommand insertPatient = new SqlCommand("INSERT INTO patients (phone, firstname, lastname, address_ID) VALUES (@phoneNumb, @firstname, @lastname, @address_ID", con);
insertPatient.Parameters.AddWithValue("@phoneNumb", this.phoneTextBox.Text);
insertPatient.Parameters.AddWithValue("@firstname", this.firstNameBox.Text);
insertPatient.Parameters.AddWithValue("@lastname", this.firstNameBox.Text);
insertPatient.Parameters.AddWithValue("@address_ID", this.comboBox1.SelectedIndex.ToString());
Console.WriteLine(this.comboBox1.SelectedIndex);
int i = insertPatient.ExecuteNonQuery();

con.Close(); SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\\...Database.mdf;Integrated Security=True;Connect Timeout=30");
con.Open();
SqlCommand insertPatient = new SqlCommand("INSERT INTO patients (phone, firstname, lastname, address_ID) VALUES (@phoneNumb, @firstname, @lastname, @address_ID", con);
insertPatient.Parameters.AddWithValue("@phoneNumb", this.phoneTextBox.Text);
insertPatient.Parameters.AddWithValue("@firstname", this.firstNameBox.Text);
insertPatient.Parameters.AddWithValue("@lastname", this.firstNameBox.Text);
insertPatient.Parameters.AddWithValue("@address_ID", this.comboBox1.SelectedIndex.ToString());
Console.WriteLine(this.comboBox1.SelectedIndex);
int i = insertPatient.ExecuteNonQuery();

con.Close();
SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\....\\Database.mdf;Integrated Security=True;Connect Timeout=30");
con.Open();
SqlCommand insertPatient = new SqlCommand("INSERT INTO patients (phone, firstname, lastname, address_ID) VALUES (@phoneNumb, @firstname, @lastname, @address_ID", con);
insertPatient.Parameters.AddWithValue("@phoneNumb", this.phoneTextBox.Text);
insertPatient.Parameters.AddWithValue("@firstname", this.firstNameBox.Text);
insertPatient.Parameters.AddWithValue("@lastname", this.firstNameBox.Text);
insertPatient.Parameters.AddWithValue("@address_ID", this.comboBox1.SelectedIndex.ToString());
Console.WriteLine(this.comboBox1.SelectedIndex);
int i = insertPatient.ExecuteNonQuery();

con.Close(); SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=C:\\...Database.mdf;Integrated Security=True;Connect Timeout=30");
con.Open();
SqlCommand insertPatient = new SqlCommand("INSERT INTO patients (phone, firstname, lastname, address_ID) VALUES (@phoneNumb, @firstname, @lastname, @address_ID", con);
insertPatient.Parameters.AddWithValue("@phoneNumb", this.phoneTextBox.Text);
insertPatient.Parameters.AddWithValue("@firstname", this.firstNameBox.Text);
insertPatient.Parameters.AddWithValue("@lastname", this.firstNameBox.Text);
insertPatient.Parameters.AddWithValue("@address_ID", this.comboBox1.SelectedIndex.ToString());
Console.WriteLine(this.comboBox1.SelectedIndex);
int i = insertPatient.ExecuteNonQuery();

con.Close();
11 replies
CC#
Created by Akama Aka on 11/25/2023 in #help
Beginners cross platform UI Framework with Rider
Hello, I want to develop a cross platform Chat Software in C# to improve my C# experience for school and the state exam. Now I dont know what UI Framework and Template is good to start into because the Windows Form things are not compatble with Linux etc and yea. I also use Linux to develop all my projects and yea I've already tried GTK# but I get the whole time errors if I want to start the program and the documentation is like theres not really one
19 replies
CC#
Created by Akama Aka on 8/30/2023 in #help
❔ Manifest file for Windows Service & winget Integration
Hello, I have a Windows Service project and want to implement winget versioning but I'm very new in this whole language and in the real programming so I dont really know things like that. Does someone know how I can create a good manifest file with all Settings I need and what is recommended with some instructions for what this is? Thanks for the help 9557kannalove I use Rider and Visual Studio so prob. a Visual Studio and Rider Version
28 replies