ASP.NET アプリケーションと MySQL データベースがあります。データベースからデータを挿入、削除、および表示するクラスを作成します。データベースに接続していますが、データベースにデータを挿入できません。
私のクラスの挿入方法:
public string CreateEntry(string Connectionstring, string mitarbeiter)
{
connection = new MySqlConnection(Connectionstring);
try
{
var command = connection.CreateCommand();
command.CommandText = "INSERT INTO tb_mitarbeiter (Vorname) VALUES ('tom')";
connection.Open();
return "Mitarbeiter wurde angelegt";
}
catch (Exception ex)
{
return ex.Message;
}
finally
{
connection.Close();
}
}
はConnectionstring
正しいです。エラーにはなりませんが、データベースにデータがありません。
私のテーブル名: tb_mitarbeiter 列: ID と Vorname