mysql=”insert into tb_componentversioninformation(componentid,componentversion,componentcreator,creationtime,maintechnique,operationsystemid,presupposition,Componentupdate)VALUES(’”+lblcompid.Text+”’,’”+txtversion.Text+”’,’”+ddlcompauth.SelectedItem.Text+”’,’”+txtcretime.Text+”’,’”+txtmaintech.Text+”’,’”+os+”’,’”+txtpre.Text+”’,’”+compupdate.Text+”’)”
mycomd=New SqlCommand(mysql,myconn)
mycomd.ExecuteNonQuery()
mysql=”select versionid from tb_componentversioninformation where(componentid=’”+lblcompid.Text+”’and componentversion=’”+txtversion.Text+”’)”
mycomd=New SqlCommand(mysql,myconn)
myrd=mycomd.ExecuteReader
myrd.Read()
versionid=myrd.Item(”versionid”)
myrd.Close()
mysql=”insert into tb_componentusageinformation(componentid,componentversion, componentinstruction, componentexample,componentpath,codefilepath,versionid)VALUES(’”+lblcompid.Text+”’,’”+txtversion.Text+”’,’”+txtinstr.Text+”’,’”+txtexam.Text+”’,’”+txtcomppath.Value()+”’,’”+txtcodefp.Value()+”’,’”+versionid+”’)”
mycomd=New SqlCommand(mysql,myconn)
mycomd.ExecuteNonQuery()
Response.Redirect(”Success.aspx”)
End If
myconn.Close()
End Sub
End Class
4.构件修改信息页面
说明:以下代码为修改构件信息页面的vb代码。
Imports System.Data
Imports System.Data.SqlClient
Public Class componentedit
Inherits System.Web.UI.Page
Protected WithEvents txtcomppath As System.Web.UI.HtmlControls.HtmlInputFile
Protected WithEvents txtcodefp As System.Web.UI.HtmlControls.HtmlInputFile
Protected WithEvents rfv11 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents rfv14 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents txtcompupdate As System.Web.UI.WebControls.TextBox
Protected WithEvents txtpre As System.Web.UI.WebControls.TextBox
Protected WithEvents txtmaintech As System.Web.UI.WebControls.TextBox
Protected WithEvents txtexam As System.Web.UI.WebControls.TextBox
Protected WithEvents txtinstr As System.Web.UI.WebControls.TextBox
Protected WithEvents txtfuncintro As System.Web.UI.WebControls.TextBox
Protected WithEvents txtcompintro As System.Web.UI.WebControls.TextBox
Protected WithEvents lblcompid As System.Web.UI.WebControls.Label
Protected WithEvents ddlprodtype As System.Web.UI.WebControls.DropDownList
Protected WithEvents lblCompName As System.Web.UI.WebControls.Label
Protected WithEvents ddltool As System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlcompfunc As System.Web.UI.WebControls.DropDownList
Protected WithEvents btnfinish As System.Web.UI.WebControls.Button
Protected WithEvents ddlcompauth As System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlcompcate As System.Web.UI.WebControls.DropDownList
Protected WithEvents rfv10 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents rfv16 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents rfv13 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents rfv12 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents rfv15 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents rfd17 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents rfv18 As System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents Image1 As System.Web.UI.WebControls.Image
Protected WithEvents ddlos As System.Web.UI.WebControls.DropDownList#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 conn As SqlConnection
Dim cmd As SqlCommand
Dim rd As SqlDataReader
Dim sql As String
Dim now As DateTime
Dim compid As String
Dim versionid As String
Dim id As String
conn=New SqlConnection(”server=(local);database=Componentsystem;Trusted_
Connection=yes”)
conn.Open()
compid=Session(”compid”)
lblcompid.Text=compid
versionid=Session(”versionid”)
sql=”select componentName from tb_ComponentBasicInformation where ComponentID
=’”+lblcompid.Text+”’”
cmd=New SqlCommand(sql,conn)
lblCompName.Text=CType(cmd.ExecuteScalar(),String)
sql=”select componentcategoryid from tb_componentbasicinformation where
(componentid=’”+compid+”’)”
cmd=New SqlCommand(sql,conn)
rd=cmd.ExecuteReader
rd.Read()
id=rd.Item(”componentcategoryid”)
rd.Close()
sql=”select categoryname from tb_componentcategory where
(componentcategoryid=’”+id+”’)”
cmd=New SqlCommand(sql,conn)
rd=cmd.ExecuteReader
rd.Read()
ddlcompcate.Items.Add(rd(”categoryname”))
rd.Close()
sql=”Select categoryname From tb_componentcategory”
cmd=New SqlCommand(sql,conn)
rd=cmd.ExecuteReader
Do While rd.Read
ddlcompcate.Items.Add(rd(”categoryname”))
Loop
rd.Close()
sql=”select toolid from tb_componentbasicinformation where(componentid=’”
+compid+”’)”
cmd=New SqlCommand(sql,conn)
rd=cmd.ExecuteReader
rd.Read()
id=rd.Item(”toolid”)
rd.Close()
sql=”select toolname from tb_tool where(toolid=’”+id+”’)”
cmd=New SqlCommand(sql,conn)
rd=cmd.ExecuteReader
rd.Read()
ddltool.Items.Add(rd(”toolname”))
rd.Close()
sql=”Select toolname From tb_tool”
cmd=New SqlCommand(sql,conn)
rd=cmd.ExecuteReader
Do While rd.Read