日期:2014-05-18 浏览次数:20961 次
public DataSet Query(string SQLString) { using (OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Persist Security Info=True;Data Source=|DataDirectory|\YTNum.accdb;Jet OLEDB:Database Password=;")) { DataSet ds = new DataSet(); try { connection.Open(); using (OleDbDataAdapter command = new OleDbDataAdapter(SQLString, connection)) { command.Fill(ds, "ds"); } } catch (System.Data.OleDb.OleDbException ex) { throw new Exception(ex.Message); } return ds; } }
static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); new DB ().Query("Select * from sysConfig"); Application.Run(new XtraForm1()); } }