Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 对数据库的更改无法更新-visual basic_Sql_Database_Vb.net_Ms Access - Fatal编程技术网

Sql 对数据库的更改无法更新-visual basic

Sql 对数据库的更改无法更新-visual basic,sql,database,vb.net,ms-access,Sql,Database,Vb.net,Ms Access,我在从21点游戏中获取分数以更新到记分板数据库中的分数表时遇到问题。当我单击save score时,它会将当前用户名和分数添加到ScoresDataGridView中,但当我关闭应用程序并检查数据库时,不会进行任何更改。我一直没能弄明白这一点。任何帮助都会很好。谢谢 Private Sub ButtonSaveScore_Click(sender As Object, e As EventArgs) Handles ButtonSaveScore.Click ScoresBindin

我在从21点游戏中获取分数以更新到记分板数据库中的分数表时遇到问题。当我单击save score时,它会将当前用户名和分数添加到ScoresDataGridView中,但当我关闭应用程序并检查数据库时,不会进行任何更改。我一直没能弄明白这一点。任何帮助都会很好。谢谢

Private Sub ButtonSaveScore_Click(sender As Object, e As EventArgs) Handles 
ButtonSaveScore.Click

    ScoresBindingSource.MoveLast()

    Dim scoreRow As ScoreboardDataSet.ScoresRow
    scoreRow = Me.ScoreboardDataSet.Scores.NewScoresRow()
    scoreRow.UserName = LabelPlayerName.Text
    scoreRow.Score = LabelWinsCounter.Text

    Me.ScoreboardDataSet.Scores.Rows.Add(scoreRow)

    Me.ScoresTableAdapter.Update(Me.ScoreboardDataSet)


    Try
        Me.Validate()
        Me.ScoresBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.ScoreboardDataSet)
        MsgBox("Update successful")

    Catch ex As Exception
        MsgBox("Update failed")
    End Try
End Sub

请为使用的编程语言添加适当的标记。TableAdapter更新和插入查询是什么样子的?为什么要直接更新分数表,然后对整个数据集调用UpdateAll,这不是有点多余吗?当重新打开应用程序时,更改是否仍然存在?不,更改永远不会保存在应用程序内或数据库中。每次重新启动应用程序时,数据库都会恢复到原始输入。我尝试以两种方式进行更改,因为两种方式都不起作用。我不熟悉表适配器和数据库。我的程序在运行时似乎对数据库进行了更改,但它们从未保存。