sqlHelper = new SqlHelper();
sqlHelper.OpenConnection();
int i;
String sqlSt = string.Empty;
for (i = 0; i < tag.Count; i++)
{
sqlSt = "Select TagID from TagsList where TagName= '" + tag[i] + "'";
ds = sqlHelper.ExecuteDataSet(sqlSt, CommandType.Text);
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
//dt = ds1.Tables[0];
ds.Tables[0].Rows.Add(ds);
}
}
}
return ds;
我想將一個數據集添加到另一個數據集,最後返回累積數據集。將數據集添加到另一個數據集(如C#中的DataRow)
我得到一個錯誤 - Unable to cast object of type 'System.Data.DataSet' to type 'System.IConvertible'.Couldn't store <System.Data.DataSet>
編輯:要我要的是我得到的是由一個特定的int值的各型我的for循環的運行,我想所有的這些記錄添加到DataSet該數據集,然後回到我的數據集
您必須逐行排列DataTable。而不是Add()使用ImportRow() –