不说了直接上代码:
try{ String str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" + address + "'"; con = new OleDbConnection(str); con.Open(); OleDbCommand cmd = con.CreateCommand(); //获得数据 OleDbDataAdapter dagroup = new OleDbDataAdapter("select DATA_NAME from BL_BUILD group by DATA_NAME ", con); DataSet dsgroup = new DataSet(); dagroup.Fill(dsgroup, "ddgroup"); //执行sql 语句 cmd.CommandText = item; int num = cmd.ExecuteNonQuery(); con.Close(); } catch (Exception ex) { con.Close(); con.Dispose(); throw ex; }
喜欢给我留言哦