Protected Sub Page_Load(sender As Object, e As EventArgs)
bind()
bind()
If Not IsPostBack Then
bind()
End If
bind()
End If
End Sub
Public Sub bind()
sqlcon = New SqlConnection(strCon)
Dim sqlstr As String = "select * from dep"
sqlcon = New SqlConnection(strCon)
Dim myda As New SqlDataAdapter(sqlstr, sqlcon)
Dim myds As New DataSet()
sqlcon.Open()
myda.Fill(myds, "test")
GridView1.DataSource = myds
GridView1.DataKeyNames = New String() {"dep_no"}
GridView1.DataBind()
sqlcon.Close()
End Sub
沒有留言:
張貼留言