참고로, 저는 이것을 처리 할 수있는 여러 가지 방법이 있다는 것을 알고 있습니다 만, 저는이 프로젝트에서이 특별한 방법으로 작업해야합니다.데이터 세트에 데이터 테이블을 추가하면 데이터 세트에 2 개의 동일한 테이블이 생성되므로 추가 할 수있는 또 다른 방법이 있습니까?
VS2010에서 DataSetGenerator로 만든 DataSet에서 DataSet (DS) 및 DataTable (DT)을 만든 다음 일부 데이터와 함께 DT에 행을 추가합니다. 그런 다음 DS에 행에 데이터가 포함 된 DT를 추가하려고합니다. Visual Studio의이 시점에서 다음 코드 행으로 넘어갈 때 데이터 셋 비주얼 라이저에 두 개의 동일하게 명명 된 테이블이있는 데이터 세트가 표시됩니다. 그러나 둘 중 하나에는 데이터가 있고 다른 하나에는 데이터가 없습니다. 이것은 아마 나를 대신하여 감독하는 것이지만 그것을 식별 할 수는 없습니다. 아직도 C#을 배우므로 도움이되지 않습니다. 어떤 도움을 주셔서 감사합니다!
OLD CODE
private string getStorageKey(string strStorageAccount)
{
DataSetStorageKeyDetails ds = new DataSetStorageKeyDetails();
DataSetStorageKeyDetails.StorageKeyDetailsDataTable dt = new DataSetStorageKeyDetails.StorageKeyDetailsDataTable();
string strStorageKey = "";
dt.Rows.Add(strStorageAccount);
ds.Tables.Add(dt);
DataSet dsOut = ServiceEnclosed.InterfaceService("GetStorageKey", ds);
DataTable dtr = dsOut.Tables[0];
DataSetStorageKeyDetails.StorageKeyDetailsRow dr = dt.First();
strStorageKey = dr.StorageName;
return strStorageKey;
}
NEW CODE
private string getStorageKey(string strStorageAccount)
{
DataSetStorageKeyDetails ds = new DataSetStorageKeyDetails();
string strStorageKey = "";
ds.StorageKeyDetails.Rows.Add(strStorageAccount);
DataSet dsOut = ServiceEnclosed.InterfaceService("GetStorageKey", ds);
DataTable dtr = new DataTable();
dtr = dsOut.Tables[0];
strStorageKey = dtr.Rows[0]["StorageKey"].ToString();
return strStorageKey;
}
DataSetStorageKeyDetails 클래스 란 무엇입니까? 나는 그것을 위해 Google을 수색하고 그것에 관하여 어떤 정보도 찾아 내지 않았다. –
@GregBurghardt, 죄송합니다. DataSet과 DataTable은 DataSetGenerator로 만든 것입니다. – Gmac
변수 이름이 혼란 스럽습니다. 'ds' 변수는'DataSetStorageKeyDetails' 객체입니다. 'dt' 변수는'StorageKeyDetailsDataTable'이지만'ds'와'dt' 둘 다'DataSet'과'DataTable' 인 것처럼 사용합니다. DataSetStorageKeyDetails 및 StorageKeyDetailsDataTable 클래스가 무엇인지 알지 못하면 귀하의 질문에 답변 할 수 없습니다. –