Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using variabels in an SQL statement

Status
Not open for further replies.

Hylsan

Programmer
Mar 20, 2002
43
SE
Hi
Im using ADO and the Exchange oledb-driver to access exchange public folders, but I have a little problem. I want the program to use a variabel to store the full path to the server and then use it in the SELECT statement, as follows;

Code:
dim srvPath as string = "[URL unfurl="true"]http://server/public"[/URL]

sel = "SELECT ""DAV:contentclass"",""DAV:displayname"" FROM scope('shallow traversal of "srvPath"') WHERE ""DAV:contentclass"" = 'urn:content-classes:folder' and ""DAV:displayname"" = 'Folder'"

Does anyone have a idea how to make this work??

Regards
Tomas
 
dim srvPath as string = "
sel = "SELECT " " & DAV:contentclass & " '" & , & "' " & DAV:displayname & " " & FROM scope('shallow traversal of "srvPath"') WHERE & " " & DAV:contentclass & " " & = 'urn:content-classes:folder' and & " " & DAV:displayname & " " & = 'Folder'" & "

I think I got all my syntax right...
 
ok, my misstake...what I ment was;

What I ment was, I want the code to look like the one in the code-snippet(if you run that, it complains about table not exists). Everything works except when inserting the variabel "srvPath" into the "shallow traversal", i.e changing srvPath to " works perfectly.

Hope I made myself clearer :)

/Hylsan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top