且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何保存的HTML数据库字段

更新时间:2023-02-24 09:38:56

我想知道,如果你正在构建的完整的查询。相反,使用参数化查询,这样可以消除您的数据的问题。

I'm wondering if you are building the full query. Instead use a parameterized query and that should eliminate your data problems.

string sqlIns = "INSERT INTO table (name, information, other) VALUES (@name, @information, @other)";

SqlCommand cmdIns = new SqlCommand(sqlIns, db.Connection);
cmdIns.Parameters.Add("@name", info);
cmdIns.Parameters.Add("@information", info1);
cmdIns.Parameters.Add("@other", info2);
cmdIns.ExecuteNonQuery();