ASP.NET 操作 ACCESS
本文发布于 15 年前,部分内容可能已经失去参考价值。
OleDbConnection con = new OleDbConnection(ZhijiangSystem.Properties.Settings.Default["localDBConnectionString"].ToString());
OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["ConnectionStringXSSP"].ToString());
OleDbCommand cmd = new OleDbCommand("", con);
try
{
con.Open();
cmd.CommandText = "update [BlogCatalog] set [order] = ? where [ID] = ?";
cmd.Parameters.AddWithValue("@ID", id);
cmd.Parameters.Add("@aaaaa", OleDbType);
cmd.Parameters["@aaaaa"].Value = aaaaa;
cmd.ExecuteNonQuery();
//OleDbDataReader dr = cmd.ExecuteReader();
//while (dr.Read())
//{
// ddddd = dr["ID"].ToString();
//}
//dr.Close();
DataSet customersSet = new DataSet();
DataTable customersTable = null;
OleDbDataAdapter sda = new OleDbDataAdapter("SELECT * FROM Customers", "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind;");
sda.Fill(customersTable);
customersTable = customersSet.Tables[0];
}
catch (Exception ex)
{
zErrorLog.catchError(Request.Url.ToString(), ex.Message);
}
finally
{
con.Close();
zCountQueries.plusOnce();
}