首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我一直收到错误System.Data.SQLite.SQLiteException:'SQL logic error near "into":语法错误‘

我一直收到错误System.Data.SQLite.SQLiteException:'SQL logic error near "into":语法错误‘
EN

Stack Overflow用户
提问于 2019-10-16 17:11:58
回答 2查看 457关注 0票数 0

我找不出代码enter image description here出了什么问题

System.Data.SQLite.SQLiteException:‘“into”附近的SQL逻辑错误:语法错误’

代码语言:javascript
运行
复制
    private void BtnUpdate_Click(object sender, EventArgs e)
    {

        string StudentIDq = "update into Student (StudentID, ExamBoard, Firstname, Surname, Pure, Statistics, Mechanics, Total, " + "Average, Rank) values ('" + txtStudentID.Text + ", " + cmbExamBoard + ", " + txtFirstname.Text + "," + "" + txtSurname.Text + "," + txtPure.Text + ", " + txtStats.Text + "," + txtMechanics.Text + " + " + txtTS.Text + "," + txtAvrg.Text + "," + txtRank.Text + ")";


        ExecuteQuery(StudentIDq);
        LoadData();


    }
EN

回答 2

Stack Overflow用户

发布于 2019-10-16 17:16:23

代码语言:javascript
运行
复制
  private void BtnUpdate_Click(object sender, EventArgs e)
{

    string StudentIDq = "insert into Student (StudentID, ExamBoard, Firstname, Surname, Pure, Statistics, Mechanics, Total, " + "Average, Rank) values ('" + txtStudentID.Text + ", " + cmbExamBoard + ", " + txtFirstname.Text + "," + "" + txtSurname.Text + "," + txtPure.Text + ", " + txtStats.Text + "," + txtMechanics.Text + " + " + txtTS.Text + "," + txtAvrg.Text + "," + txtRank.Text + ")";


    ExecuteQuery(StudentIDq);
    LoadData();


}
票数 -1
EN

Stack Overflow用户

发布于 2019-10-16 19:35:38

如果要更新列,则查询将如下所示

代码语言:javascript
运行
复制
    string StudentIDq = "update Student set StudentID=" + txtStudentID.Text + ", ExamBoard= " + cmbExamBoard + ", Firstname='" + txtFirstname.Text + "', Surname='" + txtSurname.Text + "', Pure='" + txtPure.Text + "', Statistics='" + txtStats.Text + "', Mechanics='" + txtMechanics.Text + "' , Total=" + txtTS.Text + ", " + "Average=" + txtAvrg.Text + ", Rank=" + txtRank.Text + ") ;

还要添加Where条件,否则所有列都将更新

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58409765

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档