什么错这个SQLCE查询? [英] Whats wrong with this SQLCe Query?
本文介绍了什么错这个SQLCE查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在过去一小时我一直在尝试此查询的不同变体,但我得到错误的用户名和用户名是刚刚与用户名的普通字符串,我从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).
这篇关于什么错这个SQLCE查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文