大哥,大姐们,我就这20分了
我写了一个类,这个类其中有一个方法是想调用指定多少条到多少条的数据但是报错
代码:
public static DataTable ExecuteQuery(string query,int biginrow,int endrow)
{
string connectionString = System.Configuration.ConfigurationSettings.AppSettings[ "Str_sql "];
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
try
{
if((biginrow.ToString().Length != 0) || (endrow.ToString().Length != 0))
{
SqlDataAdapter adapter = new SqlDataAdapter(query, connection);
DataSet ds = new DataSet();
adapter.Fill(ds);
return ds.Tables[0];
}
else
{
SqlDataAdapter adapter = new SqlDataAdapter(query, connection);
DataSet ds = new DataSet();
adapter.Fill(ds,biginrow,endrow); // 就是这些报错 beginrow 是从多少条开始,endrow 是查询多少条
return ds.Tables[0];
}
}
finally
{
if (connection.State == ConnectionState.Open)
connection.Close();
}
} <