如何选择包含两个单词的表格 [英] How do I select a table that has two words

查看:76
本文介绍了如何选择包含两个单词的表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个预先存在的表有2个单词作为标题,当我尝试选择它时,我得到一个错误,表示该表不存在。错误显示数据库引擎只根据第一个单词搜索表格,在我的例子中是'Datalog'。

谢谢。



我尝试了什么:



I have a pre existing table that has 2 words as the header and when I try and select it I get an error saying that the table does not exist. The error shows that the Database engine is only searching for the table based on the first word which in my example is 'Datalog'.
Thanks.

What I have tried:

string strAccessSelect = "SELECT * FROM (Datalog Descriptors)";











and

var TableField = ("Datalog Descriptors");




string mytable = string.Format( "SELECT * FROM {0}" , TableField );




string strAccessSelect = mytable;

推荐答案

第一条规则是永远不要使用带有空格的名字。



违反该规则后,只需将名称放在方括号中,如下所示: br />
The first rule is to NEVER use names with whitespace in them.

Having violated that rule, just place the name in square brackets, like this:
SELECT * FROM [Datalog Descriptors]


这篇关于如何选择包含两个单词的表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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