| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 608 人关注过本帖
标题:求救asp高手,帮我解释下如下代码,在线等,急!
只看楼主 加入收藏
syycumt
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-6-8
收藏
 问题点数:0 回复次数:2 
求救asp高手,帮我解释下如下代码,在线等,急!
SqlHelper.FillDataset(Application("connectstring"), CommandType.StoredProcedure, "SELECTCOMPANY_DEPARTMENT", ds, New String() {"subcompany"})

            SqlHelper.FillDataset(Application("connectstring"), CommandType.StoredProcedure, "SELECTALLDEPARTMENT_DEPARTMENT", ds, New String() {"department"})

           

         
    Sub search()

        Dim strSubcompany, strDepartment, strFindname As String

        strSubcompany = Trim(subcompany.SelectedItem.Text)

        strDepartment = Trim(department.SelectedItem.Text)

        strFindname = Trim(findname.Text)

        If strSubcompany = "请选择..." Then
            strSubcompany = "%"
        End If

        If strDepartment = "请选择..." Then
            strDepartment = "%"
        End If

        If strFindname = "" Then
            strFindname = "%"
        End If
        Dim objReader As SqlClient.SqlDataReader
        Try

            Dim subcompanyParm As SqlParameter = New SqlParameter("@subcompany", SqlDbType.NVarChar, 50)
            subcompanyParm.Value = strSubcompany

            Dim departmentParm As SqlParameter = New SqlParameter("@department", SqlDbType.NVarChar, 50)
            departmentParm.Value = strDepartment

            Dim realnameParm As SqlParameter = New SqlParameter("@realname", SqlDbType.NVarChar, 50)
            realnameParm.Value = strFindname

            objReader = SqlHelper.ExecuteReader(Application("connectstring"), CommandType.StoredProcedure, "SEARCH_STAFF", subcompanyParm, departmentParm, realnameParm)

            Repeater1.DataSource = objReader
            Repeater1.DataBind()
        Catch exc As Exception
            Session("wrong") = "不能正确获取用户资料!" + exc.Message
            Session("returnURL") = "../document_address.aspx"
            Response.Redirect("frame/wrong.aspx")
        Finally
            objReader.Close()
        End Try
    End Sub

    Private Sub subcompany_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles subcompany.SelectedIndexChanged

        Dim ds As DataSet
        ds = New DataSet
        Dim i As Integer

        Dim subcompanyParm As SqlParameter = New SqlParameter("@subcompany", SqlDbType.NVarChar, 50)
        subcompanyParm.Value = Trim(subcompany.SelectedItem.Text)

        SqlHelper.FillDataset(Application("connectstring"), CommandType.StoredProcedure, "SELECTBYCOMPANY_DEPARTMENT", ds, New String() {"department"}, subcompanyParm)
        Dim strDepartment() As String
        strDepartment = New String() {}

        If ds.Tables("department").Rows.Count > 0 Then

            ReDim Preserve strDepartment(0)
            strDepartment(0) = "请选择..."

            For i = 1 To ds.Tables("department").Rows.Count
                ReDim Preserve strDepartment(i)
                strDepartment(i) = ds.Tables("department").Rows(i - 1)("departmentname")
            Next
        Else

            ReDim Preserve strDepartment(0)
            strDepartment(0) = "请选择..."
        End If

        department.DataSource = strDepartment
        department.DataBind()
    End Sub
End Class
搜索更多相关主题的帖子: asp 代码 解释 
2008-06-08 11:03
syycumt
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-6-8
收藏
得分:0 
2008-06-08 11:04
yms123
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
这段代码是在使用存储过程取得用户的资料。
2008-06-08 11:52
快速回复:求救asp高手,帮我解释下如下代码,在线等,急!
数据加载中...
 
   



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

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