if (reader.Read())
{
int m = dataGridView1.Rows.Count;
if (reader.GetString(2) !="")这里说数据为空,不能对NULL调用,该怎么改啊
{
string mynowbook = reader.GetString(2);
string[] nowbook = reader.GetString(2).Split(' ');
string str = "";
string s = "";
for (int i = 0; i < m; i++)
{
for (int j = 0; j < nowbook.Length; j++)
{
if (Convert.ToString(this.dataGridView1.Rows[i].Cells[1].Value) == nowbook[j]&&nowbook[j]!="")
{
s = s + nowbook[j]+" ";
}
}
str = str + Convert.ToString(this.dataGridView1.Rows[i].Cells[1].Value)+" ";
}
if(!reader.IsDBNull(2))
谢谢啦,成功了
!string.isNullOrEmpty(reader.GetString(2)) 呢