你好我得到這個錯誤 -錯誤轉換數據類型爲nvarchar爲bigint
'錯誤轉換數據類型爲nvarchar爲bigint'
同時運行這是代碼:
string idString = "1,2,3,4";
string updateSql = "UPDATE DistinctClubcard SET ProcessedYorN = 'Y' " + "WHERE CLUBCARD_NUMBER in (@flag) ";
SqlCommand UpdateCmd = new SqlCommand(updateSql, cn);
UpdateCmd.Parameters.Add(new SqlParameter("@flag", SqlDbType.NVarChar, 2000));
UpdateCmd.Parameters["@flag"].Value = idString ;
UpdateCmd.ExecuteNonQuery();
產生的SQL查詢將如下類似於('1,2,3,4')'UPDATE DistinctClubcard SET ProcessedYorN ='Y'WHUB CLUBCARD_NUMBER,注意數字周圍的引號。 – Matthew 2012-02-16 18:15:20