[問題] Linq關於"字串長度必須剛好一個字元"錯誤
查過MSDN,這個錯誤似乎是個bug
例如我的sql:
table name: customer
column: cust_id; type:varchar(8)
linq code:
DataClassesDataContext dcc = new DataClassesDataContext();
//以下這段出現錯誤
CUSTOMER customer = dcc.CUSTOMER.SingleOrDefault(c =>
c.cust_id.Equals(id)); //id為登入者之session,長度為8
if(string.IsNullOrEmpty(customer.form)) //如果該欄為null(未設定過)
{
customer.form = formsrl; //formsrl為web中要給使用者選擇更改的值
}
else
{
//...
}
錯誤訊息為"字串長度必須剛好一個字元。"
(A character string length must be exactly)
查過網路似乎為一個vs2008的bug,不知道有沒有解?@@
之後是改用SqlCommand的舊方法直接下update指令結果ok
linq就一直出現這種錯誤...orz
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 219.87.140.36
推
12/01 06:34, , 1F
12/01 06:34, 1F
→
12/01 06:35, , 2F
12/01 06:35, 2F
→
12/01 06:35, , 3F
12/01 06:35, 3F
→
12/01 13:00, , 4F
12/01 13:00, 4F
→
12/01 13:03, , 5F
12/01 13:03, 5F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章
10
25