Response.Redirect(url)
End If
If(Choise=”构件类别”)Then
url=”CategorySearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”&;choise=”
+Choise
Response.Redirect(url)
End If
End If
End Sub
End Class
页面3
Imports System.Data
Imports System.Data.SqlClient
Public Class MoreVersion
Inherits System.Web.UI.Page
Protected WithEvents imabtnSearch As System.Web.UI.WebControls.ImageButton
Protected WithEvents ddroplChoise As System.Web.UI.WebControls.DropDownList
Protected WithEvents txtKey As System.Web.UI.WebControls.TextBox
Protected WithEvents mydatalist As System.Web.UI.WebControls.DataList
#Region”Web窗体设计器生成的代码”
’该调用是Web窗体设计器所必需的。
Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Init
’CODEGEN:此方法调用是Web窗体设计器所必需的
’不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
If Not(Page.IsPostBack)Then
Dim Ds As DataSet
Dim CoName As String
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
Dim Key As String
Dim choise As String
MyConnection=New SqlConnection(”server=(local);database=Componentsystem;trusted_connection=yes”)
MyConnection.Open()
Key=Request.QueryString.Item(”txtkey.text”)
choise=Request.QueryString.Item(”choise”)
CoName=Request.QueryString(”componentname”)
MyCommand=New SqlDataAdapter(”select componentname, componentversion, creationtime,
versionID from View_Version where componentname=’”+CoName+”’”,MyConnection)Ds=New DataSet()
MyCommand.Fill(Ds,”goujian”)
mydatalist.DataSource=Ds.Tables(”goujian”).DefaultView
mydatalist.DataBind()
End If
End Sub
Private Sub imabtnSearch_Click ( ByVal sender As System.Object,ByVal e AsSystem.Web.UI. ImageClickEventArgs)Handles imabtnSearch.Click
Dim val As String
Dim Choise As String
Dim url As String
Choise=ddroplChoise.SelectedItem.Text
If(txtKey.Text=””)Then
url=”error.aspx?Choise=”+Choise
Response.Redirect(url)
Else
If(Choise=”构件名称”)Then
url=”Componentnamesearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”&;choise=”+Choise
Response.Redirect(url)
End If
If(Choise=”构件功能”)Then
url=”ComponentFunctionSearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”
&;choise=”+Choise
Response.Redirect(url)
End If
If(Choise=”构件项目”)Then
url=”ProjectSearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”&;choise=”
+Choise
Response.Redirect(url)
End If
If(Choise=”构件作者”)Then
url=”CreatorSearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”&;choise=”
+Choise
Response.Redirect(url)
End If
If(Choise=”构件类别”)Then
url=”CategorySearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”&;choise=”
+Choise
Response.Redirect(url)
End If
End If
End Sub
End Class
页面4 (下载页面)
Imports System.Data
Imports System.Data.SqlClient
Public Class Download
Inherits System.Web.UI.Page
Protected WithEvents imabtnSearch As System.Web.UI.WebControls.ImageButton
Protected WithEvents ddroplChoise As System.Web.UI.WebControls.DropDownList
Protected WithEvents txtKey As System.Web.UI.WebControls.TextBox
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents hlinkDAddress As System.Web.UI.WebControls.HyperLink#Region”Web窗体设计器生成的代码”
’该调用是Web窗体设计器所必需的。
Private Sub InitializeComponent()
End Sub
Private Sub Page_(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Init
’CODEGEN:此方法调用是Web窗体设计器所必需的
’不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
If Not IsPostBack Then
Dim version As String
version=Request.QueryString(”VersionID”)
Dim MyConnection As SqlConnection
MyConnection=New SqlConnection(”server=(local);database=Componentsystem;trusted_connection=yes”)
MyConnection.Open()
Dim MyCommand As SqlCommand=New SqlCommand(”select ComponentPath from view_download where VersionID=’”+version+”’”,MyConnection)
Dim path As String
path=CType(MyCommand.ExecuteScalar(),String)
hlinkDAddress.NavigateUrl=path
End If
End Sub
Private Sub imabtnSearch_Click(ByVal sender As System.Object,ByVal e AsSystem.Web.UI. ImageClickEventArgs)Handles imabtnSearch.Click
Dim val As String
Dim Choise As String
Dim url As String
Choise=ddroplChoise.SelectedItem.Text
If(txtKey.Text=””)Then
url=”error.aspx?Choise=”+Choise
Response.Redirect(url)
Else
If(Choise=”构件名称”)Then
url=”Componentnamesearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”
&;choise=”+Choise
Response.Redirect(url)
End If
If(Choise=”构件功能”)Then
url=”ComponentFunctionSearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”
&;choise=”+Choise
Response.Redirect(url)
End If
If(Choise=”构件项目”)Then
url=”ProjectSearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”&;choise=”+Choise
Response.Redirect(url)
End If
If(Choise=”构件作者”)Then
url=”CreatorSearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”&;choise=”+Choise
Response.Redirect(url)
End If
If(Choise=”构件类别”)Then
url=”CategorySearch.aspx?txtKey.text=”+Trim(txtKey.Text)+”&;choise=”
+Choise
Response.Redirect(url)
End If
End If
End Sub
End Class
9.构件简单查询页面
说明:以下代码为按功能简单查询的页面vb代码,按类别、项目、名称查询页面的查询代码与之相仿。
Imports System.Data
Imports System.Data.SqlClient
Public Class AllComponentFunction
Inherits System.Web.UI.Page
Protected WithEvents txtKey As System.Web.UI.WebControls.TextBox
Protected WithEvents ddroplChoise As System.Web.UI.WebControls.DropDownList