我一直在尝试写入数据库并保存到文件但我无法让它工作,也无法说明原因。
我得到的错误是:
function doGet(e) {
var html ="<input type='text' id='text' /><br><br><input type='button' id='btnGet' onclick='myClick()' value='submit' /><br><br>";
html+="<script>";
html+="document.getElementById('btnGet').onclick = function() { var e = document.getElementById('text').value; google.script.run.newEntry(e); }</script>";
return HtmlService.createHtmlOutput(html);
}
function newEntry(text) {
Logger.log(text);
var ss = SpreadsheetApp.openById(text);
var sheet = ss.getSheetByName("Sheet1");
var lr = sheet.getLastRow();
sheet.getRange(lr+1, 1, 1, 3).setValues([["First Name", "Last Name", "Email"]]);
}
其他信息:
Exception thrown: 'System.Data.OleDb.OleDbException' in System.Data.dll
以下是我正在运行的代码,非常感谢任何帮助/建议
Could not find installable ISAM.
答案 0 :(得分:0)
安装AccessDatabaseEngine然后重试。
更改连接字符串,如下所示。
Conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;DataSource=|DataDirectory|\\HoliPlanData.accdb;Trusted_Connection = True;";
答案 1 :(得分:0)
两个问题:
比较以下几行:
OleDbCommand Query = new OleDbCommand("INSERT INTO Employee (PayrollNo, FirstName, LastName, AnnualHolidayEntitlement, DaysTakenToDate) Values(@PayrollNo, @FirstName, @LastName, @AnnualHolidayEntitlement, @DaysTakenToDate");
OleDbCommand Query = new OleDbCommand("INSERT INTO Employee (PayrollNo, FirstName, LastName, AnnualHolidayEntitlement, DaysTakenToDate) Values(@PayrollNo, @FirstName, @LastName, @AnnualHolidayEntitlement, @DaysTakenToDate)");