Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linq to sql 字符串或二进制数据将被截断。声明已被终止_Linq To Sql - Fatal编程技术网

Linq to sql 字符串或二进制数据将被截断。声明已被终止

Linq to sql 字符串或二进制数据将被截断。声明已被终止,linq-to-sql,Linq To Sql,在这些更新之前,我有一个insert语句: 在db.sumbitchanges上显示错误 Topic top = (from t in db.Topics where t.id == id select t).SingleOrDefault(); top.lastpost = username + maxdate; Category ca = (from c in db.Categories wh

在这些更新之前,我有一个insert语句: 在db.sumbitchanges上显示错误

Topic top = (from t in db.Topics
                 where t.id == id
                 select t).SingleOrDefault();

top.lastpost = username + maxdate;


Category ca = (from c in db.Categories
             where c.categoryid == cat
             select c).SingleOrDefault();

ca.totaltopics = ca.totaltopics + 1;
ca.posts = ca.posts + 1;
ca.lastpost = username + maxdate;
db.SubmitChanges();     

字符串比DB列的大小长,因此结果数据不适合内部。

字符串比DB列的大小长,因此结果数据不适合内部。

听起来像是
top.lastpost
ca.lastpost
(或两者兼而有之)数据库上没有足够的空间容纳
username
+
maxdate


检查数据库字段允许的字符数,或者更改字段以允许更多字符,或者缩短输出长度-可能仅存储
username+maxdate.ToString(“yyyy-MM-dd”)
username+maxdate.ToString(“yyyy-MM-dd HH:MM:ss”)

这听起来像是
top.lastpost
ca.lastpost
(或两者)在数据库上没有足够的空间来容纳
用户名
+
maxdate


检查数据库字段允许的字符数,或者更改字段以允许更多字符,或者缩短输出长度-可能仅存储
username+maxdate.ToString(“yyyy-MM-dd”)
username+maxdate.ToString(“yyyy-MM-dd HH:MM:ss”)

我假设主题都是
。lastpost
类别。lastpost
字符串,而
用户名+maxdate
连接了两个字符串。结果可能比相应表中的
lastpost
列中的值大一些。

我假设
主题。lastpost
类别。lastpost
字符串
s,并且
用户名+最大日期
连接两个字符串。结果可能会比相应表中
lastpost
列的值稍大一些