主题:数据添加 与 刷新
当我添加一个产品后,在datagrid 里不会马上显示,只有当重新刷新后才会显示!
请问是什么原因啊???
谢谢!!
下面是相关的代码:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Trace.Warn("dddd")
binddata()
End If
End Sub
Sub binddata()
Dim ds As New DataSet
Dim tb As DataTable
Dim sql As String
Dim dv As DataView
Dim connstr As String
Dim ss As New rui1
sql = "select * from anclass"
tb = ss.gettable(sql)
dganclass.DataSource = tb.DefaultView
dganclass.DataBind()
End Sub
Private Sub tj_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tj.ServerClick
Dim anclass_str, order_str, sql As String
Dim ss As New rui1
anclass_str = anclass_txt.Value
order_str = order_txt.Value
sql = "insert into anclass(anclass,aa) values('" + anclass_str + "','" + order_str + "')"
ss.exesql(sql)
Call binddata()
End Sub
请问是什么原因啊???
谢谢!!
下面是相关的代码:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Trace.Warn("dddd")
binddata()
End If
End Sub
Sub binddata()
Dim ds As New DataSet
Dim tb As DataTable
Dim sql As String
Dim dv As DataView
Dim connstr As String
Dim ss As New rui1
sql = "select * from anclass"
tb = ss.gettable(sql)
dganclass.DataSource = tb.DefaultView
dganclass.DataBind()
End Sub
Private Sub tj_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tj.ServerClick
Dim anclass_str, order_str, sql As String
Dim ss As New rui1
anclass_str = anclass_txt.Value
order_str = order_txt.Value
sql = "insert into anclass(anclass,aa) values('" + anclass_str + "','" + order_str + "')"
ss.exesql(sql)
Call binddata()
End Sub