错误数据库 [英] Error database

查看:122
本文介绍了错误数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有此代码:

I have this code:

CommandText = "SELECT * FROM ContactsData WHERE VandutLaData BETWEEN LIKE %" + Converter.Encrypt(lblDataDeLa.Text) + "% AND LIKE %" + Converter.Encrypt(lblPanaLaData.Text) + "%";



但我得到了错误:



but i get the error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE  %FBKEHKEIKFFKEHKFAKEIKEJKEI% AND LIKE %FBKEHKEIKFFKEHKFAKEIKEJKEI%' at line 1



我在想什么?



What am I mising?

推荐答案

像LIKE参数一样的单引号?

就像''%FBKEHKEIKFFKEHKFAKEIKEJKEI%''
Single quotes around the LIKE paramater?

LIKE ''%FBKEHKEIKFFKEHKFAKEIKEJKEI%''


我将代码更改为:

CommandText ="SELECT * FROM ContactsData,在VandutLaData位于类似\"%之间+ Converter.Encrypt(lblDataDeLa.Text)+"%\"AND类似\"%"+ Converter.Encrypt(lblPanaLaData.Text)+"% \'';


但是现在有了错误:

您的SQL语法有误;检查与您的MySQL服务器版本相对应的手册以获取正确的语法,以在第1行的``LIKE''%%''和LIKE''%%''''附近使用


我看到引号有问题,问题在最后,就像%"一样,但是我的代码是正确的.我希望是这样.
I change my code to:

CommandText = "SELECT * FROM ContactsData WHERE VandutLaData BETWEEN LIKE \''%" + Converter.Encrypt(lblDataDeLa.Text) + "%\'' AND LIKE \''%" + Converter.Encrypt(lblPanaLaData.Text)+ "%\''";


but now a get the eror:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''LIKE ''%%'' AND LIKE ''%%'''' at line 1


I see there is a problem with the quotes, the probleme is at the end LIKE ''%", but my code is right. I hope so.


我曾经遇到过这个问题,但是SQL支持肯定喜欢Like命令.
这是我所做的:

I use to have this problem, but SQL support for sure the Like command.
This is what I’ve done:

LIKE ''" + po + cbIMEI.Text + po + "''



其中"po"是一个全局字符串变量,其中包含文本%"

希望获得帮助.



Where ''po'' is a global string variable that contain the text ''%''

Hope this Help.


这篇关于错误数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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