저장 프로 시저에서 IEnumerable의 결과를 얻었으므로 inorder 결과를 통해 루핑하여 열 (GUID)의 값을 가져옵니다.ienumerable에서 루핑 할 특정 열 값을 선택하십시오.
var results = GetGuids(instId);
foreach (var item in results)
{
}
public IEnumerable GetGuids(int id)
{
using (SqlCommand _command = new SqlCommand("StoredProc"))
{
_command.Connection = new SqlConnection(conString);
_command.Connection.Open();
_command.CommandType = CommandType.StoredProcedure;
_command.Parameters.AddWithValue("@ItemID", id);
return _command.ExecuteReader();
}
}
무엇이 질문입니까? –
@CamBruce 어떻게 foreach 루프 내 결과에서 Guid 열을 얻을 수 있습니다 – Masriyah
이것은 올바른 방향으로 가리킬 것입니다 : http://msdn.microsoft.com/en-us/library/system.data.sqlclient. sqldatareader.aspx –