开发者

Select String in odbc query

is there any posibility to select a string in an odbc query? i want select the sum of many excel sheets and also need the name of the excel sheet in the resulting pivottable, so i tried something like this:

strSQL = "SELECT Sum(`table" & i & "`.`Stunden`), " & GetFilenameFromPath(arrFiles) & " FROM [" & strSheet & "$] `table" & i & "` WHERE `table" & i & "`.`开发者_JAVA百科Stunden` IS NOT NULL"

but the select statement " & GetFilenameFromPath(arrFiles) & " does not work right... a select of 1 works instead! e.g:

strSQL = "SELECT Sum(`table" & i & "`.`Stunden`), 1 FROM [...]

do i have to escape the string in any form?

thanks


Well, GetFilenameFromPath will return you a string, so you need to encase this in quotes:

strSQL = "SELECT Sum(`table" & i & "`.`Stunden`), '" & GetFilenameFromPath(arrFiles) & "' FROM...

Although, I'd encourage you to be more explicit in your question. Details of the expected output of GetFilenameFromPath for you, and a specific error message would be very helpful.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜