asp.net操作SQLite数据库,插入一套数据要21秒,求大咖指导查找原因。
以下是代码:
//点击提交用车申请按钮事件
protected void UseCarButton_Click(object sender, EventArgs e)
{
string date = DateTime.Now.ToString();
if(LuXianText.Text.Trim() != "" && MuDiDiText.Text.Trim() != "")
{
//保存用车申请记录
string savesql = "insert into DriverRegForm (" +
"ShenQingRiQi,ChePaiHao,ShenQingRen,JiaShiYuan,ShiYou,LuXian,MuDiDi"+
") values ('" + date + "'," + CarList.SelectedValue + "," + _userID + "," + DriverList.SelectedValue + "," + ShiYouList.SelectedValue + ",'" + LuXianText.Text.Trim() + "','" + MuDiDiText.Text.Trim() + "')";
//更改车辆状态
//string upsql = "update Car set Use = true where id = " + CarList.SelectedValue;
SQLiteHelper.ExecuteSql(savesql);
SystemFunction.userid = _user.id.ToString();
Response.Redirect("mainpage.aspx?userid=" + SystemFunction.userid);
}
else
{
Response.Write("");
}
}
//数据库操作类中的执行SQL方法
public static int ExecuteSql(string SQLString)
{
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
{
using (SQLiteCommand cmd = new SQLiteCommand(SQLString, connection))
{
try
{
connection.Open();
int rows = cmd.ExecuteNonQuery();
return rows;
}
catch (System.Data.SQLite.SQLiteException E)
{
connection.Close();
throw new Exception(E.Message);
}
}
}
}
有没有大咖看出执行SQL语句的方法有没有问题。请告知!
就这个界面,没多少数据量。