jackiesky1206 2022-07-29 10:24 采纳率: 0%
浏览 14

asp.net操作SQLite数据库,插入一套数据要21秒,求指导查找原因

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语句的方法有没有问题。请告知!

img


就这个界面,没多少数据量。

  • 写回答

1条回答 默认 最新

  • _东_ 2022-07-29 17:57
    关注

    你所说的时间是点击操作后页面响应的时长,还是数据库执行插入数据操作的时长啊?你试试在插入数据代码前后打个断点,看看是哪个方面花的时间长呢。

    评论

报告相同问题?

问题事件

  • 创建了问题 7月29日

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog