使用VB.NET和ASP.NET以及ms-access 2003数据,我正在尝试将数据从Web表单输入到db.mdb中名为“USER”的表中.
我试过这段代码:
Protected Sub btnCreateAccount_Click(sender As Object,e As System.EventArgs) Handles btnCreateAccount.Click Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Brian\Documents\Visual Studio 2010\WebSites\WebSite3\db.mdb;User Id=admin;Password=;") Dim cmd As OleDbCommand = New OleDbCommand("INSERT INTO USER (Name,Surname,Username,Country,TelNo,Password,Address) VALUES (?,?,?)",conn) If txtPass.Text = txtCPass.Text Then cmd.Parameters.Add("@Name",OleDbType.VarChar,255).Value = txtName.Text cmd.Parameters.Add("@Surame",255).Value = txtSurname.Text cmd.Parameters.Add("@Address",255).Value = txtAddress.Text cmd.Parameters.Add("@Country",255).Value = txtCountry.Text cmd.Parameters.Add("@Username",255).Value = txtUsername.Text cmd.Parameters.Add("@Password",255).Value = txtPass.Text cmd.Parameters.Add("@TelNo",OleDbType.Integer).Value = txtTelNo.Text Try conn.Open() cmd.ExecuteNonQuery() conn.Close() Catch ex As OdbcException Throw ex Finally conn.Close() lblAccount.Visible = True End Try End If End Sub
但它给我一个错误信息:
为什么问题可能导致的任何建议?