473,395 Members | 1,613 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Ways to deal with a "-" character

I am trying to use a String as part of a query. Here is the line:

strQuery = "Select Filename, Path from d11mw-zes215643.System..SCOPE() where
Filename = 'main.swf'"

The code works IF I rename the target workstation and remove the - character
and then adjust my code accordingly. However, that isn't a real solution for
me, so what are ways to deal with the - character so that the code can handle
it?

Here is a reference I found pertaining to C# in the middle of this page, but
I can't do the exact same thing in VB.NET...

http://www.sellsbrothers.com/news/sh...x?ixTopic=1949

Thanks
Mar 23 '07 #1
3 1341
Military Smurf,

If the article is correct that you need to surround the name with
double-quote characters then you can do that in VB by using 2 double-quote
characters, like this:

strQuery = "Select Filename, Path from ""d11mw-zes215643"".System..SCOPE()
where Filename = 'main.swf'"

Kerry Moorman
"Military Smurf" wrote:
I am trying to use a String as part of a query. Here is the line:

strQuery = "Select Filename, Path from d11mw-zes215643.System..SCOPE() where
Filename = 'main.swf'"

The code works IF I rename the target workstation and remove the - character
and then adjust my code accordingly. However, that isn't a real solution for
me, so what are ways to deal with the - character so that the code can handle
it?

Here is a reference I found pertaining to C# in the middle of this page, but
I can't do the exact same thing in VB.NET...

http://www.sellsbrothers.com/news/sh...x?ixTopic=1949

Thanks
Mar 23 '07 #2
On Mar 23, 1:28 pm, Military Smurf
<MilitarySm...@discussions.microsoft.comwrote:
I am trying to use a String as part of a query. Here is the line:

strQuery = "Select Filename, Path from d11mw-zes215643.System..SCOPE() where
Filename = 'main.swf'"

The code works IF I rename the target workstation and remove the - character
and then adjust my code accordingly. However, that isn't a real solution for
me, so what are ways to deal with the - character so that the code can handle
it?

Here is a reference I found pertaining to C# in the middle of this page, but
I can't do the exact same thing in VB.NET...

http://www.sellsbrothers.com/news/sh...x?ixTopic=1949

Thanks
Not sure if it works for you in this case, but I do know that if a SQL
object like a table name or a column name has embedded spaces in it
you must enclose the object's name inside square brackets in the SQL
statement as in:

strQuery = "Select Filename, Path from [d11mw-
zes215643].System..SCOPE() where
Filename = 'main.swf'"

Mar 23 '07 #3
Ah, that's the ticket.

DOMO ARIGATO GOZAIMASU!!!

"Kerry Moorman" wrote:
Military Smurf,

If the article is correct that you need to surround the name with
double-quote characters then you can do that in VB by using 2 double-quote
characters, like this:

strQuery = "Select Filename, Path from ""d11mw-zes215643"".System..SCOPE()
where Filename = 'main.swf'"

Kerry Moorman
"Military Smurf" wrote:
I am trying to use a String as part of a query. Here is the line:

strQuery = "Select Filename, Path from d11mw-zes215643.System..SCOPE() where
Filename = 'main.swf'"

The code works IF I rename the target workstation and remove the - character
and then adjust my code accordingly. However, that isn't a real solution for
me, so what are ways to deal with the - character so that the code can handle
it?

Here is a reference I found pertaining to C# in the middle of this page, but
I can't do the exact same thing in VB.NET...

http://www.sellsbrothers.com/news/sh...x?ixTopic=1949

Thanks
Mar 23 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: FLEB | last post by:
I have a function which should convey two things upon its completion. First, the return value of the function, consisting of some text. Second, it should convey an "error status", which, could be...
3
by: JP SIngh | last post by:
Hi All I have been asked to do a project which deal with user entering data but most of the answers are to be added to the database. The forms will be editable as well so all the checkbox values...
1
by: Piper707 | last post by:
Hi, I need to generate an XML file for the result which differs based on the value of a "status" attribute. i.e for an error condition it would look something like this: <result...
38
by: Zytan | last post by:
What is the difference between these two lines? Dim args As Object() = New Object() {strText} Dim args As Object() = {strText} args seems usuable from either, say, like so: ...
6
by: Killer42 | last post by:
I have actually asked a pretty similar question here in the past, without a great deal of success. But I've decided to try a different tack. So, what are the ways in which a network admin could...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.