撇号 - 当使用它与我的odbc混乱 [英] Apostrophe - when used it mucks with my odbc

查看:62
本文介绍了撇号 - 当使用它与我的odbc混乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


当用户将Apostrophe输入到表单上的文本区域字段时,即

没有,它就会变得很糟糕odbc如下


[微软] [ODBC Microsoft Access驱动程序]语法错误(缺少运算符)

查询表达式''''没有' ',


除了不输入撇号之外,最好的方法是处理这个问题。

我当时的后端数据库是其中的一部分一个现有的

申请表。


任何帮助都非常感激,即使是幽默我可能也不理解!


干杯

Hi All,

When a user enters an Apostrophe into a text area field on a form, i.e.
didn''t, it mucks with odbc as follows

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in
query expression ''''didn''t'',

Whats the best way to handle this, other than not entering the apostrophe.
I''m stuck with the current backend database as its part of an existing
application.

Any help gratefully appreciated, even with humour I may not understand!

Cheers

推荐答案

.. oO(Johnny BeGood)
..oO(Johnny BeGood)

> ;当用户将Apostrophe输入到表单上的文本区域字段中时,即
没有,它与odbc混淆如下

[Microsoft] [ODBC Microsoft Access Driver]语法
查询表达式中的错误(缺少运算符) ''没有',
>When a user enters an Apostrophe into a text area field on a form, i.e.
didn''t, it mucks with odbc as follows

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in
query expression ''''didn''t'',



这不仅打破了查询,而且允许攻击者注入任意恶意SQL命令
。不好。

This not only breaks the query, but allows an attacker to inject
arbitrary malicious SQL commands. Not good.


>除了不输入撇号之外,最好的办法是什么。
>Whats the best way to handle this, other than not entering the apostrophe.



你_always_必须确保输入数据库的数据不能造成任何伤害。为了达到这个目的,你必须使用
1)逃避所有在SQL中具有特殊含义的字符



2)使用准备好的陈述


第二个是首选,但它是否可用取决于使用的数据库后端和界面上的



Micha

You _always_ have to make sure that the data entered into a DB can''t do
any harm. To achieve that you have to

1) escape all chars that have a special meaning in SQL
or
2) use prepared statements

The second is the preferred, but whether it''s available or not depends
on the used DB backend and the interface.

Micha


您好Micha,


感谢您的回复,能否给我一些答复指导
Hi Micha,

Thanks for the reply, can you give me some guidance on

2)使用准备好的陈述


第二个是首选,但它是否可用在使用的DB后端和接口上取决于

2) use prepared statements

The second is the preferred, but whether it''s available or not depends
on the used DB backend and the interface.



我用过

I have used


stmt = odbc_prepare(
stmt = odbc_prepare(


这篇关于撇号 - 当使用它与我的odbc混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆