myConn.Close()
End Sub
Public Sub Fill(ByVal sqlstr As String)
myAdapter = New SqlDataAdapter(sqlstr, myConn)
ds = New DataSet
myAdapter.Fill(ds)
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
If Not Session("UserID") Is Nothing Then
If AllowBooking(Session("UserID")) = True Then
End If
End If
End If
End Sub
'private bind
Public Function GetRowsNum(ByVal sqlstr As String) As Integer
If myConn.State = ConnectionState.Closed Then
myConn.Open()
End If
Fill(sqlstr)
Close()
Return ds.Tables(0).Rows.Count
End Function
Public Function AllowBooking(ByVal UserID As String) As Boolean
Dim sqlstr As String = "select * from UserInfo,RoleInfo where UserInfo.RoleID=RoleInfo.RoleID and AllowBooking=1 and UserID='" + UserID + "'"
If GetRowsNum(sqlstr) = 0 Then
Return False
Else
Return True
End If
End Function
Public Sub BindDBGrd(ByVal sqlstr As String, ByVal myDBGrd As DataGrid)
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>