编辑记录不会在asp.net中产生任何结果 [英] Editing record does not bring about any result in asp.net
本文介绍了编辑记录不会在asp.net中产生任何结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下代码来填充我的数据集(ASP.Net)
Hi,
I have following code to fill my dataset (ASP.Net)
Dim conStr As String = "Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\dbTest.mdf;Integrated Security=True;User Instance=True"
Dim sqlQry As String = "SELECT * FROM tblTest"
Dim dAdt As New SqlDataAdapter(sqlQry, conStr)
Dim dSet As New DataSet()
dAdt.Fill(dSet, "tblTest")
然后我正在使用以下内容来编辑我的记录
Then I am using following to edit my record
Dim dRow As DataRow
dRow = dSet.Tables("tblTest").Rows(1)
dRow.BeginEdit()
dRow.Item("Name") = txtName.Text
dRow.EndEdit()
dSet.Tables("tblTest").AcceptChanges()
它不会产生任何错误,但也不会编辑记录.当我尝试使用delete命令删除记录时,也会发生同样的情况.请指教.
谢谢
it does not generate any error but does not edit the record too. Same is happening when I try to delete record using delete command. Please advise.
Thanks
推荐答案
您应该致电更新 [ ^ ]方法EndEdit
之后的适配器.这会将更改反映回数据库.
You should call the Update[^] method of the adapter after EndEdit
. This reflects the changes back to the database.
这篇关于编辑记录不会在asp.net中产生任何结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文