求救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