-1
如何傢伙過程或函數有許多參數指定
我有問題,這個錯誤,我希望你們能幫助我
在這裏:這是從SQL Server程序更新我的記錄
CREATE PROCEDURE UPDATEnewsAR(@img varchar(max),@con ntext,@id varchar(10))
as
begin
update newsAR set img= @img , con = @con where [email protected];
end
和這裏的C#代碼
public void updatefullnewsAR(string img ,string con ,string id)
{
conn.ConnectionString = @"Data Source=.\sqlexpress;Initial Catalog=TestDB;Trusted_Connection=True;";
conn.Open();
comma.Connection = conn;
comma.CommandType = System.Data.CommandType.StoredProcedure;
comma.CommandText = "UPDATEnewsAR";
comma.Parameters.AddWithValue("@img", img);
comma.Parameters.AddWithValue("@con", con);
comma.Parameters.AddWithValue("@id", id);
comma.ExecuteNonQuery();
conn.Close();
}
謝謝
請出示完整的錯誤消息,表明其在何處發生,包括變量的聲明。然後我們可以判斷是否重複使用'Command'並且每次通過代碼添加參數。 – HABO 2014-08-29 20:49:38
可疑,逗號不是本地函數。我建議你在調試器中檢查它,看看實際設置了哪些參數。 – ths 2014-08-29 20:52:11