SQLite Select...Where 语句“没有这样的列";错误 [英] SQLite Select...Where statement "no such column" error

查看:31
本文介绍了SQLite Select...Where 语句“没有这样的列";错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下 SQLite 语句:

I have the following SQLite statement:

"SELECT * FROM HISTORICALPICKS WHERE BETTYPE = " + betType.ToString().ToUpper() + " ORDER BY DATETIME ASC"

而 betType.ToString().ToUpper() 是字符串ATS"

And betType.ToString().ToUpper() is the string "ATS"

由于某种原因,我收到以下错误:

For some reason I get the following error:

System.Data.SQLite.SQLiteException : SQL logic error or missing database
no such column: ATS

...这让我很困惑.ATS 不是列.BETTYPE 是列.我希望它选择在 BETTYPE 列中具有ATS"的行.

...which leaves me baffled. ATS is not a column. BETTYPE is the column. I want it to select rows that have "ATS" in the BETTYPE column.

我的预感是语法有问题.这是一张显示表名和列名的图片,以及值 ATS 的突出显示:

My hunch is that something is wrong with the syntax. Here is a picture showing the table name and column name, along with a highlight of the value ATS:

推荐答案

您需要将值用单引号括起来.

You need single quotes around the value.

"SELECT * FROM HISTORICALPICKS WHERE BETTYPE = '" + betType.ToString().ToUpper() + "' ORDER BY DATETIME ASC"

这篇关于SQLite Select...Where 语句“没有这样的列";错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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