私はMicrosoft Accessデータベースを操作するためにC#でこの行を書きました
OleDbCommand sComm = new OleDbCommand
("Update TableToBeImport set TextDefault = '" + resxValue + "'
WHERE ControlName = '" + resxKey + "'" , c);
resxValue
およびresxKey
すべて文字列変数です。
2 つの文字列変数が「abc」、「xyz」などの単純な場合は問題ありませんが、1 つの文字列変数が複雑になると、私の場合は次のようになります。
チップ:
料金プランと RPT エラーを修正するには、「再処理」を使用します
キャリア、トランク グループ、トレーダー エラーを修正するには、「削除して再挿入」を使用します
プログラムはエラーをスローし、デバッグを行うと、sComm.CommandText は次の形式になります。
TableToBeImport set TextDefault = 'TIPS: \r\n1 を更新します。料金プランと RPT エラーを修正するには、「再処理」を使用します\r\n2. キャリア、トランク グループ、トレーダー エラーを修正するには、「削除して再挿入」を使用します WHERE ControlName = 'frmCDRQuery.label7.Text'
私はC#で@
、文字列変数の前に使用できることを知っているので、その中のエスケープ文字は無視されます。しかし、アクセスでは、どうすれば同じ結果を得ることができますか?