Imports System.Data.SqlClient
Public Class delete
Inherits System.Web.UI.Page
Dim myconn As SqlConnection
Private connectingstring As String
Private ds As DataSet
Private myAdapter As SqlDataAdapter
Private myCmd As SqlCommand
Public Sub BindDBGrd(ByVal sqlstr As String, ByVal myDBGrd As DataGrid)
If myConn.State = ConnectionState.Closed Then
myConn.Open()
End If
Fill(sqlstr)
myDBGrd.DataSource = ds.Tables(0).DefaultView
myDBGrd.DataBind()
End Sub
Public Sub Fill(ByVal sqlstr As String)
myAdapter = New SqlDataAdapter(sqlstr, myConn)
ds = New DataSet
myAdapter.Fill(ds)
End Sub
Public Sub BindDBGrd(ByVal sqlstr As String, ByVal myDBGrd As DataGrid, ByVal SortExp As Object)
If myconn.State = ConnectionState.Closed Then
myconn.Open()
End If
Fill(sqlstr)
Dim dv As DataView = ds.Tables(0).DefaultView
dv.Sort = SortExp
myDBGrd.DataSource = dv
myDBGrd.DataBind()
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
connectingstring = "data source=(local);Database=library;uid=sa;pwd=123456;"
myconn = New SqlConnection(connectingstring)
If Not IsPostBack Then
Dim sqlstr As String = "select * from bookinfo "
BindDBGrd(sqlstr, DataGrid1)
Dim ds As DataSet = New DataSet
End If
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] ... 下一页 >>