登陆注册
8724600000046

第46章 软件工程实例——构件库管理系统(10)

Trusted_Connection=yes”)

Dim StrSQL As String

StrSQL=”select AttributeID,AttributeName from tb_ClassAttribute where ClassID=’”+CLassID+”’”

MyCommand=New SqlDataAdapter(StrSQL,MyConnection)

Dim ds As DataSet

ds=New DataSet()

MyCommand.Fill(ds,”tb_ClassAttribute”)

MydataGrid.DataSource=ds.Tables(”tb_ClassAttribute”).DefaultView

MydataGrid.DataBind()

End Sub

Private Sub ChangeLink()

hlkEvent.NavigateUrl=”wfrmEvent.aspx?ClassId=”+lblClassID.Text+”&;VersionID=”+VersionId

hlkMethod.NavigateUrl=”wfrmMethod.aspx?ClassId=”+lblClassID.Text+”

&;VersionID=”+VersionId

hlkBase.NavigateUrl=”wfrmBase.aspx?ClassId=”+lblClassID.Text+”&;VersionID=”

+VersionId

hlkSuper.NavigateUrl=”wfrmSuper.aspx?ClassId=”+lblClassID.Text+”&;VersionID=”+VersionId

hlkClass.NavigateUrl=”wfrmClass.aspx?ClassId=”+lblClassID.Text+”&;VersionID=”+VersionId

hlkEvent.Visible=True

hlkMethod.Visible=True

hlkBase.Visible=True

hlkSuper.Visible=True

hlkClass.Visible=True

End Sub

Private Sub unable_Link()

hlkEvent.Visible=False

hlkMethod.Visible=False

hlkBase.Visible=False

hlkSuper.Visible=False

hlkClass.Visible=False

End Sub

Private Sub txtBox_init()

txtAttriName.ReadOnly=True

txtAttriIns.ReadOnly=True

txtAttriEg.ReadOnly=True

txtAttriType.ReadOnly=True

btnSave.CommandArgument=”Add”

btnEdit.Enabled=False

btnAdd.Enabled=True

btnSave.Enabled=False

btnCancel.Enabled=False

lblMessage.Visible=True

lblError.Text=””

lblErrType.Text=””

lblMessage.Text=”*单击添加新增属性”

End Sub

Private Sub save(ByVal ClassId As String)

If(Page.IsValid)Then

Dim myConn As New SqlConnection(”server=(local);database=componentSystem;Trusted_Connection=yes”)

myConn.Open()

Dim StrSQL As String

StrSQL=”Select AttributeName From tb_ClassAttribute Where AttributeName=’”

+Trim(txtAttriName.Text)+”’and ClassID=’”+ClassId+”’”

Dim myCommand As SqlCommand=New SqlCommand(StrSQL,myConn)

Dim reader As SqlDataReader

reader=myCommand.ExecuteReader()

If reader.Read()Then

lblError.Text=”*该属性已存在!”

reader.Close()

lblSave.Text=””

Exit Sub

Else

reader.Close()

StrSQL=”INSERT INTO tb_ClassAttribute(ClassId, AttributeID,AttributeName,AttributeType,AttributeInstruction,AttributeExample)values(’”+ClassId+_”’,’”+lblAttriID.Text+”’,’”+txtAttriName.Text+”’,’”+ txtAttriType.Text+”’,’”+txtAttriIns.

Text+”’,’”+txtAttriEg.Text+”’)”

myCommand=New SqlCommand(StrSQL,myConn)

myCommand.ExecuteNonQuery()

lblSave.Visible=True

lblSave.Text=”*注册成功!”

ChangeLink()

MYbind(ClassId)

txtBox_init()

myConn.Close()

End If

End If

End Sub

Private Sub update(ByVal ClassID As String)

If(Page.IsValid)Then

Dim myConn As New SqlConnection(”server=(local);database=componentSystem;Trusted_Connection=yes”)

myConn.Open()

Dim StrSQL As String

Dim myCommand As SqlCommand

StrSQL=”update tb_ClassAttribute set AttributeInstruction=’”+txtAttriIns.

Text_+”’,AttributeExample=’”+txtAttriEg.Text+”’,AttributeType=’”+txtAttriType.Text+”’

where AttributeID=’”+lblAttriID.Text+”’”

myCommand=New SqlCommand(StrSQL,myConn)

myCommand.ExecuteNonQuery()

lblSave.Visible=True

lblSave.Text=”*修改成功!”

ChangeLink()

txtBox_init()

myConn.Close()

MYbind(ClassID)

End If

End Sub

Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load

If Not IsPostBack Then

startIndex=0

End If

lblClassID.Text=Request.QueryString().Item(”ClassID”)

ClassID=lblClassID.Text

VersionId=Request.QueryString().Item(”VersionID”)

Dim myConn As New SqlConnection(”server=(local);database=ComponentSystem;Trusted_Connection=yes”)

myConn.Open()

Dim StrSQL As String

StrSQL=”Select ClassName FROM tb_ClassInformation where ClassId=’”+lblClassID.Text+”’”

Dim Comm As SqlCommand=New SqlCommand(StrSQL,myConn)

lblClassName.Text=CType(Comm.ExecuteScalar(),String)

MYbind(lblClassID.Text)

unable_Link()

txtAttriName.Enabled=True

lblError.Text=””

lblErrType.Text=””

ChangeLink()

End Sub

P rivate Sub btnAdd_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles btnAdd.Click

Dim myConn As New SqlConnection (”server=(local);database=ComponentSystem;Trusted_Connection=yes”)

myConn.Open()

Dim StrSQL As String

StrSQL=”Select count(AttributeID)as exper1 FROM tb_ClassAttribute”

Dim countComm As SqlCommand=New SqlCommand(StrSQL,myConn)

If(CType(countComm.ExecuteScalar(),Integer)=0)Then

lblAttriID.Text=”A1000001”

Else

StrSQL=”SELECT MAX(RIGHT(AttributeID,7))as exper1 FROM tb_ClassAttribute”

Dim myCommand As SqlCommand=New SqlCommand(StrSQL,myConn)

Dim id As Integer

id=CType(myCommand.ExecuteScalar(),Integer)

id=id+1

lblAttriID.Text=”A”+CType(id,String)

End If

txtAttriName.Text=””

txtAttriIns.Text=””

txtAttriEg.Text=””

txtAttriType.Text=””

txtAttriName.ReadOnly=False

txtAttriIns.ReadOnly=False

txtAttriEg.ReadOnly=False

txtAttriType.ReadOnly=False

lblSave.Text=””

lblError.Text=””

lblErrType.Text=””

btnSave.CommandArgument=”Add”

btnEdit.Enabled=False

btnAdd.Enabled=False

btnSave.Enabled=True

btnCancel.Enabled=True

lblMessage.Visible=False

unable_Link()

lblSave.Text=””

End Sub

P rivate Sub btnSave_Click ( ByVal sender As System.Object,ByVal e AsSystem.EventArgs)Handles btnSave.Click

If(Trim(txtAttriName.Text=””))Then

lblError.Text=”*输入属性名”

Exit Sub

End If

If(Trim(txtAttriType.Text=””))Then

lblErrType.Text=”*输入属性类型”

Exit Sub

End If

If(Trim(txtAttriIns.Text=””))Then

txtAttriIns.Text=””

End If

If(Trim(txtAttriEg.Text=””))Then

txtAttriIns.Text=””

End If

If(btnSave.CommandArgument=”Add”)Then

同类推荐
  • 中文版AutoCAD2005建筑绘图精讲精学

    中文版AutoCAD2005建筑绘图精讲精学

    本书从中文版AutoCAD2005建筑绘图的基础进行介绍,讲解了建筑绘图的环境设置、二维建筑图形的绘制、二维建筑及装饰图形的编辑、建筑绘图中的文字标注和图形查询、建筑装潢平面图中的尺寸标注、建筑绘图中图块的应用、建筑平面图的绘制、建筑立面图的绘制、建筑剖面图的绘制、建筑绘图中的三维造型、三维建筑模型绘制及建筑图纸的布局与打印输出等内容。
  • 现代企业财务软件应用教程

    现代企业财务软件应用教程

    本书内容包括财务软件概论、系统管理、企业应用平台、总账管理、报表管理、薪资管理、固定资产管理、应收款管理、应付款管理等。
  • 创业在微软

    创业在微软

    身处软件巨擘微软之中,何来“创业”二字?本书详尽勾勒了微软亚洲工程院(ATC)的成长历程,披露了工程院人在“创业”过程中不为人知的种种酸甜苦辣,生动展现了工程院的独特文化,并从另一个角度展现了其领袖人物张宏江博士的心路历程和管理思想。
  • 中文版3dsMax2010实例与操作

    中文版3dsMax2010实例与操作

    本书结合3dsMax2010的实际用途,按照系统、实用、易学、易用的原则,通过大量案例介绍了3dsMax2010的各项功能,内容涵盖3dsMax入门、创建和编辑二维图形、创建基本三维模型、使用修改器、网格建模、多边形建模、面片建模、复合建模、材质和贴图、灯光和摄影机、渲染、动画制作、粒子系统、空间扭曲和动力学等。
  • 科学伴你行-神奇的通信技术

    科学伴你行-神奇的通信技术

    在日常生活中,有时人们要借助于小旗子来进行通信联络,比如,开运动会时,发令员常常要用小旗子与计时员联系;当你乘坐火车进入车站时,都会看到车站工作人员拿着红色和绿色的小旗子在站台上进行指挥;在战争中,打出白色旗子表示投降,插上红色旗子表明胜利;航行在茫茫大海上的船只,双方船员会凭不同旗帜组成的标志,来了解对方的意思。以上种种用小旗子来“说话”的通信方式就叫做旗语。
热门推荐
  • 奈执悟

    奈执悟

    何为执念?一阵尖笑划破天空妖神鬼魔一声令下,屠尽天下唯有他,只有他他便为她的念他便为她的梦可终归只是场梦而他终归只是想。那又如何,他终是红了眼眶。
  • 於尽风云

    於尽风云

    在异空间,有着一片处处是争斗的大陆。一名普通大学生穿越过去,如何生存下来并创造奇迹。
  • 混在娱乐圈的肖白

    混在娱乐圈的肖白

    这是一条咸鱼重生后,发现自己并没有金手指。只能靠着家里关系,混在娱乐圈的故事,却发现自己已经是一个霸道总裁……于是开始放飞自我地过程……本书设定,平行空间,与现实无关。已开大侦探剧情,后续有鸡条等……
  • 镜子和糖果

    镜子和糖果

    镜子是真相,糖果是奖励,而生活是美好的,我们应该享受生活,爱上生活。
  • 上战天穹

    上战天穹

    我本是哪平平无奇的高中生,你却让我绝望又将我从绝望中拉起。我又是哪宗门中的优秀弟子,你却将我推入深渊又留我一线生机。我在是哪山间的猎兽人,你却穷追不舍,步步紧逼,我只能觉醒。天与我不仁,我便拔剑斗天穹。人与我不义,我便杀尽不义人。
  • 大黑天神法

    大黑天神法

    本书为公版书,为不受著作权法限制的作家、艺术家及其它人士发布的作品,供广大读者阅读交流。
  • 天行

    天行

    号称“北辰骑神”的天才玩家以自创的“牧马冲锋流”战术击败了国服第一弓手北冥雪,被誉为天纵战榜第一骑士的他,却受到小人排挤,最终离开了效力已久的银狐俱乐部。是沉沦,还是再次崛起?恰逢其时,月恒集团第四款游戏“天行”正式上线,虚拟世界再起风云!
  • 折去

    折去

    生而为人,我不懂,为什么借我通透与敏感冰冷,后来我明了,前半生的用尽苦难,当是我余生欢喜的前奏。当我断翼再生,他们再也束缚不住。我折尽苦难,披荆斩棘,从此天高地阔任我遨游。——沈淮
  • 知识格言(现代名言妙语全集)

    知识格言(现代名言妙语全集)

    这些名言警句句句经典,字字珠玑,精辟睿智,闪耀着智慧的光芒和精神的力量,具有很强的鼓舞性、哲理性和启迪性。具有成功心理暗示和潜在力量开发的功能,不仅可以成为我们的座右铭,还能增进自律的能力。
  • 大战神之路

    大战神之路

    一个从小经脉萎缩的废物,除了坑爹还是坑爹,却是为了亲爹逆袭了,踏上了大战神之路!一个为了不再坑爹而选择离家出走的废物,却是在无意间打开了尘封千载的秘密!一个本不应该活在这个世纪的人,却是为了追寻上几个世纪的谜团,想要打开那一扇门,却是最后只留下幽幽一声长叹:“这是一个死局!”