简体   繁体   English

访问数组元素时出现“需要标识符”错误

[英]“Identifier required” Error Accessing an Array Element

I was trying to place all the rows of the Column "Title" of the dataset into the string array. 我试图将数据集的“标题”列的所有行放入字符串数组。 But i get an error Identifier Required at strdeals[] in the last line. 但是我在最后一行的strdeals []处收到一个错误的Identifier Required。 where am i doing wrong? 我在哪里做错了?

string[] strdeals = new string[100];

Dataset dsdeal;
for(int i =0; i< dsdeal.Tables[0].Rows.Count; i++)
{

 strdeals[] =  dsdeal.Tables[0].Rows[i]["Title"].Tostring();
}

You haven't subscripted the strdeals array. 您尚未为strdeals数组添加下标。 Try this: 尝试这个:

strdeals[i] = dsdeal.Tables[0].Rows[i]["Title"].ToString();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM