Dim datas As String = AppDomain.CurrentDomain.BaseDirectory + "db1.mdb"
str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + datas
conn = New OleDb.OleDbConnection(str)
conn.Open()
Dim strsql As String
Dim sql As String
strsql = "insert into yonghu(UserType,username,password)VALUES('" & (ComboBox1.SelectedItem) & "','" & (TextBox1.Text) & "','" & Trim(TextBox2.Text) & "')"
Dim cmd As New OleDb.OleDbCommand(strsql, conn)
cmd.ExecuteNonQuery()
我在运行的时候总是说SQL语句语法错误,确定是textbox2那里的问题,因为我如果只添加前两项内容
的话就是正确的,但我实在是找不出错误在哪里,在表中password字段的格式是 文本型的.
还是菜鸟的说,刚接触不久,哪位大虾能帮忙解决,感激不尽!!!