| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 641 人关注过本帖
标题:什么代码啊?看不懂!
只看楼主 加入收藏
mlphao
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-4-2
收藏
 问题点数:0 回复次数:1 
什么代码啊?看不懂!
这种代码是什么代码啊?
是.net吗??
还是别的什么啊?
Imports System.Data.SqlClient
Imports
Public Class searchN
    Inherits System.Web.UI.Page
    Private connectingstring As String
    Private myConn As SqlConnection
    Private ds As DataSet
    Private myAdapter As SqlDataAdapter
    Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
    Protected WithEvents radiobutton1 As System.Web.UI.WebControls.RadioButton
    Protected WithEvents dropdownlist1 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents button1 As System.Web.UI.WebControls.Button
    Private myCmd As SqlCommand

    Public Sub Open()
        myConn.Open()
    End Sub
    Public Sub Close()
        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)

        If myConn.State = ConnectionState.Closed Then
            myConn.Open()
        End If
        Fill(sqlstr)
        myDBGrd.DataSource = ds.Tables(0).DefaultView
        myDBGrd.DataBind()

    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 BindGrid()
        If Not Session("sqlstr") Is Nothing Then
            Dim sqlstr As String = CType(Session("sqlstr"), String)

            BindDBGrd(sqlstr, ResultGrid)
            Session("sqlstr") = sqlstr
        End If
    End Sub


    Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
        Dim sign As String = ""
        If AnyChoice.Checked = True Then
            sign = "%"
        End If
        Dim sqlstr As String = "select  * from BookInfo where 1=1 "


        sqlstr += " and " + dropdownlist1.SelectedValue + " like '" + sign + txtContent.Text.ToString.Trim + sign + "' "
        Session("sqlstr") = sqlstr
        BindGrid()
    End Sub

    Private Sub ResultGrid_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles ResultGrid.PageIndexChanged
        ResultGrid.CurrentPageIndex = e.NewPageIndex
        BindGrid()
    End Sub

    Private Sub ResultGrid_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles ResultGrid.SortCommand
        Dim sqlstr As String
        If viewstate("sortexp") Is Nothing Then
            viewstate("sortexp") = e.SortExpression.ToString
        ElseIf viewstate("sortexp") = e.SortExpression.ToString Then
            viewstate("sortexp") += " desc"
        Else
            viewstate("sortexp") = e.SortExpression.ToString
        End If
        If Not Session("sqlstr") Is Nothing Then
            sqlstr = CType(Session("sqlstr"), String)

            BindDBGrd(sqlstr, ResultGrid, Viewstate("sortexp"))
        End If
    End Sub


    Public Sub ExecNonSql(ByVal sqlstr As String)
        If myConn.State = ConnectionState.Closed Then
            myConn.Open()
        End If
        myCmd = New SqlCommand(sqlstr, myConn)
        myCmd.ExecuteNonQuery()
        myCmd.Dispose()
        Close()
    End Sub


End Class
搜索更多相关主题的帖子: 代码 
2008-04-26 15:23
marer
Rank: 2
等 级:新手上路
威 望:3
帖 子:928
专家分:0
注 册:2005-7-18
收藏
得分:0 
这好像是代码吧

public class 人生历程 extends Thread{public void run(){while(true){努力,努力,再努力!!;Thread.sleep(0);}}}
2008-04-26 16:31
快速回复:什么代码啊?看不懂!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.034960 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved