问题描述
- 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-PCSQLEXPRESS;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
时间: 2024-09-14 22:07:15