vba Microsoft Jet OLEDB 4.0 SQL 函数参考与 ADO?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8766386/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 14:52:00  来源:igfitidea点击:

Microsoft Jet OLEDB 4.0 SQL Function Reference with ADO?

excelms-accessvbaadojet

提问by Tommy O'Dell

I'm using the the Microsoft.Jet.OLEDB.4.0 provider in Excel VBA ADO to connect to .csv and .xls files stored locally. I'm using the list of MS Access functions hereas a guide for what I can write in SQL for Jet. But not all functions are supported and I'm having issues figuring out the syntax for certain things.

我在 Excel VBA ADO 中使用 Microsoft.Jet.OLEDB.4.0 提供程序连接到本地存储的 .csv 和 .xls 文件。我使用的MS Access函数列表这里是什么,我可以在SQL编写为Jet的指南。但并非所有功能都受支持,我在弄清楚某些事情的语法时遇到了问题。

Question 1

问题 1

Is there a reference somewhere for the set of SQL functions that I can use in my Jet queries through ADO?

我可以在通过 ADO 的 Jet 查询中使用的 SQL 函数集在某处有参考吗?

Question 2

问题2

What's the right syntax for an IF (or CASE) statement? Without the IF, the query below runs fine.

IF(或 CASE)语句的正确语法是什么?如果没有 IF,下面的查询运行良好。

    sql = "            SELECT "
    sql = sql & "        Date() as `Import Date`, "
    sql = sql & "        `Name` as `User`, "
    sql = sql & "        `Role Title` as `Role`, " 
    sql = sql & "        If 1=1 Then 1 Else 0 EndIf as `testing` "
    sql = sql & "      FROM [Sheet1$] a "

Resources

资源

I don't see what I'm looking for in any of the answers provided here, hereand here.

此处此处此处提供的任何答案中,我都看不到我在寻找什么。

This looks like it should be the right place but it doesn't seem to show how to use IF/CASE in a SELECT statement, or what string functions are available

这看起来应该是正确的地方,但它似乎没有显示如何在 SELECT 语句中使用 IF/CASE,或者哪些字符串函数可用

http://office.microsoft.com/en-us/access-help/CH006252688.aspx

http://office.microsoft.com/en-us/access-help/CH006252688.aspx

回答by Doug Glancy

For question 1, this SO answerlists some good resources, including a link to an Intermediate SQL for Jet 4.0 article.

对于问题 1,此SO answer列出了一些很好的资源,包括指向Intermediate SQL for Jet 4.0 文章的链接

For question 2, do a search for the Iifand Switchfunctions.

对于问题 2,搜索IifSwitch函数。