我有一个 ms sql 2012 服务器,我使用这个函数来添加/记录:
static String conString = "Provider=SQLOLEDB;Data Source = " + ecommerceServer + "; Initial Catalog = " + eCommercedbName + "; User Id = " + eCommerceUsername + "; Password = " + eCommercepassword + ";";
public bool InsertSQL(String query, String Tablename)
{
OleDbConnection conn = new OleDbConnection(conString);
try
{
conn.Open();
OleDbCommand command = new OleDbCommand(query, conn);
int count = command.ExecuteNonQuery();
return (count > 0) ? true : false;
}
catch
{
if (conn.State.ToString() == "Open")
{
conn.Close();
}
}
return false;
}
该功能很慢(例如,我对 MySQL 有类似的执行,它的工作速度要快得多。有没有比这更快的方法OleDb
?