저는 ASP.net 웹 폼 애플리케이션의 ObjectDataSource가 지원하는 GridView로 작업하고 있습니다. GridView는 DataBase에서 많은 필드를 가져 와서 표시합니다. 이 필드 중 하나만 편집 할 수있게하려면 이미 몇 가지 문제가 있습니다. ObjectDataSource를위한 내 업데이트 명령은 다음과 같습니다ObjectDataSource를 사용하여 GridView의 단일 필드에 대한 데이터를 업데이트 하시겠습니까?
public void UpdateRML(string itemCode, int newRML)
{
SqlCommand cmd = new SqlCommand("UpdateRML_byItemCode", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter ItemCodeParameter = new SqlParameter("@itemCode", SqlDbType.NVarChar);
ItemCodeParameter.Value = (itemCode);
cmd.Parameters.Add(ItemCodeParameter);
SqlParameter NewRMLParamter = new SqlParameter("@RML", SqlDbType.Int);
NewRMLParamter.Value = (newRML);
cmd.Parameters.Add(NewRMLParamter);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}
당신이 볼 수 있듯이, 두 개의 매개 변수를 복용하고 업데이트 할 데이터베이스에 저장 프로 시저에 전달하여 작동합니다. 불행히도 나는 "편집"단추를 누른 후 GridView를 눌러이 오류가 발생합니다. 이런 식으로 뭔가를 말했다 어디이 article on msdn을 읽었다으로 나는 놀라운 일이 아니었다 추측의 GridView의 모든 필드를 포함 할 필요가 있다고 말하는하지만 방법이 필요 초조
ObjectDataSource 'ObjectDataSource1' could not find a non-generic method
'UpdateRML' that has parameters: p, itemcode, newRML, itemname, RML, Buyer, Vendor,
AvgCost, FWAC, MSRP, SalePrice, Profit_Ave, Profit_MSRP, onHand, isCommited, onOrder, ATS,
AOH, Vintage, Producer, Country, Region, Appellation, CRU, Size, RtrakDept, str.
꽤 많은 itemcode와 새로운 데이터 이외에 아무것도 사용하지 않을 때 모든 매개 변수를 가져옵니다.
그래서이 문제를 해결하는 가장 좋은 방법은 무엇입니까? 내가해야 할 것보다 더 복잡하게 만드는가? 우스운 서명으로이 방법을 사용해야할까요? 더 많은 정보가 필요하면 알려주세요! 고맙습니다.