大侠们帮小弟我看下,错了啊 Cannot assign to 'ds' because it is a 'using variable'
大侠们帮小弟我看下,错了啊 Cannot assign to 'ds' because it is a 'using variable'
日期:2014-05-18 浏览次数:20398 次
大侠们帮我看下,错了啊 Cannot assign to 'ds' because it is a 'using variable' using System; using System.Data; using System.Data.OleDb; using System.Configuration; namespace DataBase { public class DataAccess { //返回DataTable对象 public static DataTable ReturnDataTable(string cmdText) { using (DataSet ds=new DataSet()) { ds=ReturnDataSet(cmdText); return ds.Tables[0]; } }
//返回DataSet对象 public static DataSet ReturnDataSet(string cmdText) { using (OleDbConnection conn = new OleDbConnection(connectionString)) { using (OleDbCommand cmd = new OleDbCommand()) { PrepareCommand(conn, cmd, cmdText); using (OleDbDataAdapter da = new OleDbDataAdapter()) { da.SelectCommand = cmd; using (DataSet ds = new DataSet()) { da.Fill(ds); return ds; } } } } } } }
DataSet ds=DataAccess.ReturnDataSet(sql);
报错啊,Cannot assign to 'ds' because it is a 'using variable',要怎么改啊大侠门