ADODB使用JavaScript插入Access DB时出错

时间:2015-05-28 10:32:56

标签: javascript asp.net ado adodb

我正在编写一个.asp文件,使用以下JS将数据插入Access数据库:

    MM_query =  "INSERT " + 
                "INTO Employees (FirstName, Surname, Department, Email, FaxNumber, JobTitle, KnownAs, MobileTelephone, WorkTelephone, MUGSHOT, WorkExtension, UseInPhoneWeb, Staff, Office, MobileSpeedDial, CompanyID1) " +
                "VALUES (\"" + textFirstname + "\", \"" + textSurname + "\", \"" + selectDept + "\", \"" + textemailAddress + "\", \"" + textFaxTel + "\", \"" + textJobTitle + "\", \"" + textAKA + "\", \"" + textMobile + "\", \"" + textWorkNo + "\", \"" + selectMugShot + "\", \"" + textExtn + "\", 1, 1, \"" + selectOffice + "\", " + textMobSpDial + ", " + selectCompany + ")";

    var conn = Server.CreateObject("ADODB.Connection");
    conn.Open(MM_PhoneWeb_conn_STRING);

    var rs = Server.CreateObject("ADODB.Recordset");
    rs.Open(MM_query, conn);

    conn.Close();

执行后,我收到以下错误:

An error occurred on the server when processing the URL. Please contact the system administrator. 

查询在直接粘贴到访问时起作用,类似的代码适用于从数据库中检索数据。

有人可以建议如何最好地进行问题排查吗?

1 个答案:

答案 0 :(得分:0)

IIS用于插入数据库的帐户对包含文件夹/ DB具有只读权限。