太长了,没细看,我猜
sub page_load(.....
If Not Page.IsPostBack Then
mydatabinder()
End If
end sub 
时,不是没有插入成功,而是插入后你没有重新绑定所以看到的不是最新结果.

解决方案 »

  1.   

    Page_load就下面这样,别变
    sub page_load(.....
    If Not Page.IsPostBack Then
                mydatabinder()
       End If
    end sub 你的插入有问题错,mydatabinder() 的位置错了Private Sub Button1_Click(ByVal .....
            If TextBox1.Text = "" Then
                Response.Write("<script>alert('区域号不能为空,请检查!');</script>")
            Else
                Try
                    myrow = ds.Tables("tregion").NewRow
                    myrow("region_code") = TextBox1.Text
                    myrow("region_desc") = TextBox2.Text
                    ds.Tables("tregion").Rows.Add(myrow)
                    inta = SqlDataAdapter1.Update(ds, "tregion")
                    If inta > 0 Then
                        Response.Write("<script>alert('插入记录成功!');</script>")
                        TextBox1.Text = ""
                        TextBox2.Text = ""
                        '    ds.Tables("tregion").Clear()
                        'mydatabinder() 不要放这里
                    End If
                Catch ex As Exception
                    Response.Write("<script>alert('插入失败,区域号不能重复!');</script>")
                    '  ds.Tables("tregion").Clear()
                    'mydatabinder() 不要放这里
                End Try
            End If
           mydatabinder() '绑定放这里
        End Sub