由网友(温柔的男孩像蓝天i)分享简介:在过去一小时我一直在尝试此查询的不同变体,但我得到错误的用户名和用户名是刚刚与用户名的普通字符串,我从XML文件中不包含特殊字符或任何获得in the past hour i have been trying different variants of this query but i get error at th...
在过去一小时我一直在尝试此查询的不同变体,但我得到错误的用户名和用户名是刚刚与用户名的普通字符串,我从XML文件中不包含特殊字符或任何获得
in the past hour i have been trying different variants of this query but i get error at the username , and the username is just a normal string with username that i get from xml file containing no special characters or whatsoever
我使用SLQ紧凑型3.5
I'm using SLQ compact 3.5
P.S我试图用?而不是@用户名也无法正常工作 所有feilds都的nchar,除了约会
P.S i tried to use ? instead of @username also not working all feilds are "nchar" except "date"
C = nodeItem["user_from"].InnerText;
avatar = nodeItem["user_from_avatar"].InnerText;
string msgText = nodeItem["message"].InnerText;
DateTime dt=DateTime.Now;
string sql = "INSERT INTO posts(user,msg,avatar,date) VALUES(@username,@messige,@userpic,@thedate)";
using (SqlCeCommand cmd = new SqlCeCommand(sql, connection))
{
cmd.Parameters.Add("@username",C);
cmd.Parameters.Add("@messige", msgText.ToString());
cmd.Parameters.Add("@userpic", avatar.ToString());
cmd.Parameters.Add("@thedate", dt);
connection.Open();
cmd.ExecuteNonQuery();
adapter.Update(data);
connection.Close();
}
该错误消息: 谢谢 , 尼古拉·
The error msg : Thanks , Nikola
推荐答案
尽量围绕用户用方括号[用户](以及可能的日期)。
Try surrounding 'user' with square brackets, '[user]' (and possibly date).
相关推荐
最新文章