私は1つの問題で立ち往生しており、私はこれを解決できません。 私はこのエラーを取得:無効な列名: "値" - エラー別のフォームでも機能します。
コード:
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
string query = "UPDATE CAC SET nextMaintainance = @nextMaintainance WHERE department = " + @departmentCB.Text;
SqlCommand command = new SqlCommand(query, connection);
command.Parameters.AddWithValue("@nextMaintainance", nextMaintainanceDT.Value);
command.ExecuteNonQuery();
私は理解していない奇妙なことは、同様のコードがすべてのエラーでなしだけで正常に動作していることです私のプロジェクト:
query = "UPDATE LDV SET received = @received, department = @department WHERE Id =" + @idTxt.Text;
command = new SqlCommand(query, connection);
command.Parameters.AddWithValue("@received", inDT.Value);
command.Parameters.AddWithValue("@department", departmentCb.Text);
command.ExecuteNonQuery();
MessageBox.Show("Lungenautomat wurde aktualisiert");
関連がある場合は、私の接続文字列:
connectionString = ConfigurationManager.ConnectionStrings["SCBA_Manager_0._1.Properties.Settings.SCBAmanagerConnectionString"].ConnectionString;
私は本当にあなたが私を助けることができると思います:( ありがとうございます!
私はこれを試しましたが、うまくいきませんでした。今度はもう一度試してみました。奇妙な、しかしたくさんありがとう! しかし、このようなさらなるエラーを避けるために、私はパラメータ化されたSQLを試してみるでしょうあなたのヒントありがとう! – USAfirefighter
あなたは歓迎です、@USAfirefighter。この回答があなたの問題を解決するのに役立った場合は、_Answered_ – Phylyp