日期:2014-05-18 浏览次数:21035 次
private static OleDbConnection conn; public static OleDbConnection Conn { get { try { string connstr = ""; if (conn == null) conn = new OleDbConnection(connstr); if (conn.State == ConnectionState.Closed) conn.Open(); if (conn.State == ConnectionState.Broken) { conn.Close(); conn.Open(); } return conn; } catch (Exception ex) { throw; } } } //查询:DataTable public static DataTable GetTable(string SqlStr) { try { OleDbDataAdapter dap = new OleDbDataAdapter(SqlStr, Conn); DataSet ds = new DataSet(); dap.Fill(ds); conn.Close(); return ds.Tables[0]; } catch (Exception ex) { throw; } }
------解决方案--------------------
看一下连接语句是否写错
------解决方案--------------------
上面的Xp,
win7如下
win7中Spy++才发现开始菜单就是窗口 class Program { // 获得窗体句柄 [DllImport("user32.dll")] public static extern IntPtr FindWindow(String className, String captionName); [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hwnd, uint nCmdShow); static void Main(string[] args) { // 获得任务栏句柄 var rwl = FindWindow("Shell_TrayWnd", null); //当nCmdShow=0:隐藏;=1:显示 ShowWindow(rwl, 0); var rwl2 = FindWindow("Button", null); ShowWindow(rwl2, 0); Console.Read(); ShowWindow(rwl2, 1); ShowWindow(rwl, 1); } }
------解决方案--------------------
我去,错了,回答错了地方
------解决方案--------------------