使用未指派变量
public static DataTable ExecuteSelectCommand(DbCommand dbcommand)
{
DataTable table;
try
{
//打开数据连接
dbcommand.Connection.Open();
DbDataReader reader = dbcommand.ExecuteReader();
table = new DataTable();
table.Load(reader);
reader.Close();
}
catch (Exception ex)
{
}
finally
{
dbcommand.Connection.Close();
}
return table;
}
以上代码为什么在返回值时提示:use unassigned local variable 'table'
table 不是已经定义过了吗