当前位置:编程学习 > C#/ASP.NET >>

vb 界面中除了前两个Textbox外其余都不能从键盘录入

连接的表是 出租登记表,代码如下,希望能够帮忙找错,尽快!谢谢!

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Trim(TextBox1.Text) = "" Then
            MsgBox("必须输入出租登记编号", MsgBoxStyle.OkOnly, "信息提示")
            Exit Sub
        End If
        'If Trim(TextBox2.Text) = "" Then
        'MsgBox("必须输入课程名", MsgBoxStyle.OkOnly, "信息提示")
        'Exit Sub
        'End If
        Dim mysql As String
        Dim mytable1 As New DataTable
        If flag = 1 Then  '新增
            mytable1 = Dbop.Exesql("SELECT * FROM 出租登记表 WHERE cno='" & TextBox1.Text & "'")
            If mytable1.Rows.Count = 1 Then
                MsgBox("输入的出租登记编号重复,不能新增", MsgBoxStyle.OkOnly, "信息提示")
                TextBox1.Focus()
                Exit Sub
            Else
                mysql = "INSERT INTO 出租登记表 VALUES( '" & _
                TextBox1.Text & "','" & TextBox2.Text + "','" & _
                TextBox3.Text & "','" & TextBox4.Text + "','" & _
                TextBox5.Text & "','" & TextBox6.Text + "','" & _
                TextBox7.Text & "','" & TextBox8.Text & "')"
                mytable1 = Dbop.Exesql(mysql)
                Me.Close()
            End If
        Else    '修改
            mysql = "UPDATE 出租登记表 SET pno='" & TextBox2.Text & _
            "',manager='" & TextBox3.Text & "',cstart='" & TextBox4.Text & _
            "',clast='" & TextBox5.Text & "',cpno='" & TextBox6.Text & _
            "',hno='" & TextBox7.Text & "',zno='" & TextBox8.Text & "' WHERE cno='" & TextBox1.Text & "'"
            mytable1 = Dbop.Exesql(mysql)
            Me.Close()
        End If
    End Sub --------------------编程问答-------------------- 报什么错啊 --------------------编程问答-------------------- 就只是不能录入   已经解决了,谢谢!
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,