程序为:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Then
Label1.Text = "请将内容填完后再提交!"
Else
Dim mycon As New OleDbConnection
Dim mycmd As New OleDbCommand
mycon.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & Server.MapPath("data7/db7.mdb")
mycon.Open()
mycmd.Connection = mycon
mycmd.CommandText = "insert into table_1(name,title,content,time_) values " & "('" & TextBox1.Text & "', '" & TextBox2.Text & "','" & TextBox3.Text & "','" & Now() & "')"
mycmd.ExecuteNonQuery()
mycmd = Nothing
mycon.Close()
Response.Redirect("look.aspx")
End If
End Sub
错误为:
查询值的数目与目标字段中的数目不同。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.OleDb.OleDbException: 查询值的数目与目标字段中的数目不同。
源错误:
行 43: mycmd.CommandText = "insert into table_1(name,title,content,time_) values " & "('" & TextBox1.Text & "', '" & TextBox2.Text & "','" & TextBox3.Text & "','" & Now() & "')"
行 44:
行 45: mycmd.ExecuteNonQuery()
行 46: mycmd = Nothing
行 47: mycon.Close()
源文件: c:\inetpub\wwwroot\fanqiang2\write.aspx.vb 行: 45
希望大家给以指点!!!!!!!!!!!!!!!!!