2 tracyliuyan127 tracyliuyan127 于 2014.08.12 09:52 提问

ASP VB 想要把textbox的数据存入数据库 下面是代码 存不进去 也不提示错误
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim p_name1 As String = ""
    Dim p_type1 As String = ""

    If p_name.Text IsNot Nothing AndAlso p_name.Text <> "" Then
        p_name1 = p_name.Text
    End If
    If p_type.Text IsNot Nothing AndAlso p_type.Text <> "" Then
        p_type1 = p_type.Text
    End If

    Dim strcon As String
    Dim cnn As OleDbConnection
    Dim cmd As OleDbCommand
    Dim sqlstr As String

    strcon = "Provider=SQLOLEDB;data source=LENOVO-PC\SQLEXPRESS;initial catalog= kailuan;uid=sa;pwd=19890127llyy;integrated security=sspi; "
    cnn = New OleDbConnection(strcon)
    cnn.Open()
    sqlstr = "Insert INTO User(账号,密码) Values('" + p_name1 + "','" + p_type1 + "')"
    cmd = New OleDbCommand(sqlstr, cnn)





End Sub

End Class

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!