// 获取和设置要读取的列
public string Columns
...{
set
...{
this.columns = value.Trim();
if (this.columns == "") this.columns = "*";
isDirty = true;
}
get ...{ return this.columns; }
}
// 获取和设置读取的条件
public string Conditions
...{
set ...{ this.conditions = value.Trim(); isDirty = true; }
get ...{ return this.conditions; }
}
// 获取或设置排序
public string Orders
...{
set ...{ this.orders = value.Trim(); isDirty = true; }
get ...{ return this.orders; }
}
// 获取设置连接字串
public string ConnectionString
...{
set ...{ this.connectionString = value; isDirty = true; }
get ...{ return this.connectionString; }
}
// 获取SQL查询命令
public string SelectCommand
...{
get
...{
StringBuilder command = new StringBuilder(256);
command.AppendFormat("select {0} from [{1}] ", columns, table);
if (conditions != "")
...{
command.AppendFormat(" where {0}", conditions);
}
if (orders != "")
...{
command.AppendFormat(" order by {0}", orders);
}
return command.ToString();
}
}
// 获取异常信息
public string ErrMessage
...{
get ...{ return errorMessage; }
}
// 执行分页
public bool DoPaging()
...{
errorMessage = "";
// 生成统计SQL
StringBuilder sqlParas = new StringBuilder(256);
sqlParas.AppendFormat("from [{0}] ", table);
if (conditions != "")
...{
sqlParas.AppendFormat(" where {0}", conditions);
}
String sqlCount = "select count(*) as [RowCount] " + sqlParas.ToString();
// 开始统计
OleDbConnection conn = new OleDbConnection(connectionString);
try
...{
conn.Open();
}
catch (Exception e)
...{
errorMessage = e.Message;
return false;
}

