내 질문을 시작하기 전에 언급해야 할 것은 C++ 프로그래머가 아니기 때문에 코드 구문이 잘못되었을 수도 있습니다. 나는 아마추어이고 개선이 필요하다. ;;)내 데이터 세트에 데이터 어댑터가 채워진 결과?
데이터 어댑터 출력 결과로 작업하는 것에 대해 질문이있다. 의이 논문 라인을 살펴 보자 :
public DataSet CollectData()
{
DataSet result = new DataSet();
using (SqlConnection conn = new SqlConnection(connectionString))
using (SqlCommand cmd = new SqlCommand("dbo.StoredProc1", conn))
{
cmd.CommandType = CommandType.StoredProcedure;
IDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(result);/// filling a dataset
return result;
}
}
을이 기능은 데이터 세트를 작성하고 그것을 돌려 볼 수있다. 나는이 저장된 개체를 보여 클래스를 가지고
DataSet dataSet = DataObj.CollectData(); /// above function!
string token;
string lemma;
foreach (DataRow row in dataSet.Tables[0].Rows)
{
token = ((string)row["Token"]);
lemma = ((string)row["Lemma"]);
...
//// TODO: ex. write to file
}
하지만 : 외부에서 I는 다음과 같이 그것을 통해 내가 루프해야이 개체를 사용하려는. 이 같은
클래스는 :
public class Lexeme
{
private int tokenId = -1;
private string token;
private string lemma;
/// some get and set functions!
}
이 클래스는 객체를 보유하고 보는 바와 같이 어쨌든
그래서 내가 알고 싶은이 (가 데이터베이스 테이블 내부에 저장된 객체의 래퍼 같은 뭔가) 데이터 집합 대신이 개체의 목록 (여기 Lexeme)을 반환 하시겠습니까? 나는 효율적인 메모리 사용을 의미합니다. 엄청난 양의 데이터로 작업하기 때문입니다. 이 같은
예를 들어 뭔가 :
public MYDATASET CollectData()
{
MYDATASET result = new MYDATASET();
using (SqlConnection conn = new SqlConnection(connectionString))
using (SqlCommand cmd = new SqlCommand("dbo.StoredProc1", conn))
{
cmd.CommandType = CommandType.StoredProcedure;
IDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(result);/// filling a dataset
return result;
}
}
데이터 세트는 상속 될 수 있는가?
신의 축복이 있기를, 나는 이것을 정확히 찾고있었습니다 ... http : //support.microsoft.com/kb/320714 – Mostafa