以下是引用片段:
其主要代码实现过程如下: Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click '判断信息是否正确 If Me.txtID.Text = "" Then Response.Write("alert('实验室名称不能为空');") Exit Sub End If '添加或修改实验室信息 Dim tmpcnn As New Sql2000DB Select Case Request.QueryString("Tag") Case "New" If tmpcnn.GetData("select * from 实验室 where 实验室名称='" & Me.txtID.Text.Trim() & "'").Rows.Count > 0 Then Response.Write("alert('实验室名称重复');") Exit Sub End If tmpcnn.SetData("insert into 实验室(实验室名称,实验室介绍,实验室位置,实验室负责人,联系电话,备注) " _ & " values('" & Me.txtID.Text & "','" & Me.txtXm.Text & "','" & Me.TextBox1.Text & "','" & Me.TextBox2.Text & "','" & Me.txtZw.Text & "','" & Me.txtJj.Text & "')") Case "Old" tmpcnn.SetData("update 实验室 set 实验室名称='" & Me.txtID.Text & "',实验室介绍='" & Me.txtXm.Text & "',实验室位置='" & Me.TextBox1.Text & "',实验室负责人='" & Me.TextBox2.Text & "',联系电话='" & Me.txtZw.Text & "',备注='" & Me.txtJj.Text & "' where 实验室编号=" & Request.QueryString("bh")) End Select Response.Redirect("SysList.aspx") , E,nd Sub |