首页 \ 问答 \ 临时Access数据库的位置(Location for temporary Access databases)

临时Access数据库的位置(Location for temporary Access databases)

为了避免数据库膨胀,我经常创建临时数据库来存储工作数据表。 我想在用户的%TEMP%文件夹中创建这些文件。 但是,如果我这样做,Access会向用户显示以下对话框:

已经确定了潜在的安全问题。

文件路径:C:\ Users \ JDoe \ AppData \ Local \ Temp \ TempDb \ temp_001.mdb

要打开此文件还是取消操作?

如果我尝试将此文件夹(或%TEMP%文件夹的任何子文件夹)添加到受信任位置,我收到以下错误消息:

您使用的路径不是有效位置,或出于安全原因不能用作受信任位置; 请检查您输入的路径或选择其他位置或特定文件夹。

这有解决方法吗? 我理解禁止将%TEMP%文件夹作为受信任位置的原因。 我只是觉得自己陷入了困境22。


To avoid database bloat, I often create temporary databases to store working data tables. I'd like to create these files in the user's %TEMP% folder. However, if I do that Access presents the following dialog to the user:

A potential security concern has been identified.

File path: C:\Users\JDoe\AppData\Local\Temp\TempDb\temp_001.mdb

Do you want to open this file or cancel the operation?

If I try adding this folder (or any subfolder of the %TEMP% folder) to Trusted Locations, I get the following error message:

The path you are using is not a valid location or cannot be used as a Trusted location for security reasons; please check the path you have typed or choose another location or a specific folder.

Is there a workaround for this? I understand the reasoning behind disallowing the %TEMP% folder as a trusted location. I just feel like I'm stuck in a catch-22.


原文:https://stackoverflow.com/questions/41109257
更新时间:2021-09-16 08:09

最满意答案

首先,该表名带有连字符; MySQL数字你想在这里做数学。

$sql = "INSERT INTO o18-reg

转换为o18 减去 reg

所以把它包裹在刻度线中

$sql = "INSERT INTO `o18-reg` ...

或将其重命名为下划线。

那么你将面临另一个问题,价值。 你有什么似乎是字符串,所以你需要引用这些。

VALUES ('$title', '$firstname', '$surname' ...

并对其余的字符串执行相同的操作。

然后你面临着一个SQL注入。

使用准备好的声明:

编辑:

我只注意到,你有21列,但使用20个变量,没有进行必要的调整来弥补。 您可能会收到有关列不匹配的其他错误,这会产生以下影响:

致命错误:带有消息的未捕获异常'PDOException'。 插入值列表与列表列表不匹配:1136列计数与第1行的值计数不匹配

如果id是AI,则需要在查询中稍做调整,方法是在“

VALUES ('', '$title', '$firstname' ...

如果为它预留了一个变量(在您发布的代码中似乎不存在),则添加它。 但是,如果id列是AI,则使用上面的''


洞察力:

确保您的表单确实使用POST方法,并且所有输入都带有名称属性,并且没有拼写错误。

  • 他们似乎正确填充,但这也是未来访问者的问题。

错误报告添加到文件的顶部,这将有助于查找错误。

<?php 
error_reporting(E_ALL);
ini_set('display_errors', 1);

// rest of your code

旁注:显示错误只能在分阶段进行,而不能进行生产。


Firstly, that table name with the hyphen; MySQL figures you want to do math here.

$sql = "INSERT INTO o18-reg

Which translates to o18 minus reg

so wrap it in ticks

$sql = "INSERT INTO `o18-reg` ...

or rename it to be an underscore.

Then you'll be faced with another problem, the VALUES. You have what seems to be strings, so you'll need to quote those.

I.e.

VALUES ('$title', '$firstname', '$surname' ...

and do the same for the rest of the strings.

Then you're faced with an SQL injection.

Use a prepared statement:

Edit:

I just noticed, you have 21 columns, but using 20 variables without making the necessary adjustement to compensate. You would have received an additional error about columns do not match, something to the effect of:

Fatal error: Uncaught exception 'PDOException' with message. Insert value list does not match column list: 1136 Column count doesn't match value count at row 1

If id is an AI, you will need to make a slight adjustment in your query, by adding '' in:

VALUES ('', '$title', '$firstname' ...

If there is a variable set aside for it (which doesn't seem to be present in your posted code), then add it. However, if the id column is an AI, then use the '' above.


An insight:

Make sure that your form does use a POST method and that all inputs bear the name attributes, and with no typos.

  • They seem to be populating correctly, but this is also for future visitors to the question.

Add error reporting to the top of your file(s) which will help find errors.

<?php 
error_reporting(E_ALL);
ini_set('display_errors', 1);

// rest of your code

Sidenote: Displaying errors should only be done in staging, and never production.

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。