插入访问aspx.vb

时间:2015-06-02 04:31:04

标签: vb.net

我查看了所有主题,但我找不到这个问题的答案。  当网页试图使插入时我收到错误

第30行:cmd.ExecuteNonQuery()

我的代码:

Imports System.Data.OleDb
Imports System.Data

Partial Class _Default
Inherits System.Web.UI.Page



Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    Dim myConn As OleDbConnection
    Dim cmd As OleDbCommand
    Dim sqlString, FName, LName, Account, Supervisor, Type, Justification, Days As String

    Response.Write("<script language=""javascript"">alert('¡Gracias por participar! Tu información ha sido ingresada correctamente, posteriormente estarás recibiendo un correo indicándote los resultados de la selección.¡Suerte!!');</script>")

    FName = Name.Text
    LName = Last.Text
    Account = DropDownList1.SelectedValue
    Supervisor = Sup.Text
    Type = Typ.Text
    Justification = Jus.Text
    Days = Dayi.Text

    myConn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.15.0;Data Source=C:\Users\fernmarc\Documents\WebSite3\WebSite7\Database4.accdb")

    myConn.Open()
    sqlString = "INSERT INTO Absence (First, Last, Account, Supervisor, Type, Justification, When) VALUES (@FName, @LName, @Account, @Supervisor, @Type, @Justification, @Days) "
    cmd = New OleDbCommand(sqlString, myConn)
    cmd.ExecuteNonQuery()
    myConn.Close()



End Sub

我错过了什么?

提前致谢

1 个答案:

答案 0 :(得分:0)

你插入查询应该是这样的

byte arrays