473,396 Members | 1,997 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,396 software developers and data experts.

string error

I have a string that need to have the " char inside, but this give me an
error: end of the sring, how can i make the " a char of the string?

string comando = "OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bak'"";


Nov 16 '05 #1
8 1527
Use the escape character:

string commando = "OSQL -Usa -Psa -n -Q \"BACKUP DATABASE Rendas TO DISK =
'c:\\Rendas.dat_bak'\"";

or prefix with @ character:

string comando = @"OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bal'"";

Arild

"Tiago Costa" <aa***@aaaa.pt> wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
I have a string that need to have the " char inside, but this give me an
error: end of the sring, how can i make the " a char of the string?

string comando = "OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bak'"";


Nov 16 '05 #2
Use double-quotes ("") or maybe (\")

Lars Moastuen

On Tue, 3 Aug 2004 13:24:08 +0100, Tiago Costa <aa***@aaaa.pt> wrote:
I have a string that need to have the " char inside, but this give me an
error: end of the sring, how can i make the " a char of the string?

string comando = "OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bak'"";



--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 16 '05 #3
Prefixing with the @ would mean you'd need to double up on the quotes...

string comando = @"OSQL -Usa -Psa -n -Q ""BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bal'""";

"Arild Bakken" <ar*****@hotmail.com> wrote in message
news:e7**************@tk2msftngp13.phx.gbl...
Use the escape character:

string commando = "OSQL -Usa -Psa -n -Q \"BACKUP DATABASE Rendas TO DISK = 'c:\\Rendas.dat_bak'\"";

or prefix with @ character:

string comando = @"OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bal'"";

Arild

"Tiago Costa" <aa***@aaaa.pt> wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
I have a string that need to have the " char inside, but this give me an
error: end of the sring, how can i make the " a char of the string?

string comando = "OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bak'"";



Nov 16 '05 #4
Escape embedded " (double-quote) characters using '\'.

string comando = "OSQL -Usa -Psa -n -Q \"BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bak'\"";
"Tiago Costa" <aa***@aaaa.pt> wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
I have a string that need to have the " char inside, but this give me an
error: end of the sring, how can i make the " a char of the string?

string comando = "OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bak'"";



Nov 16 '05 #5
>
or prefix with @ character:

string comando = @"OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bal'"";


No, @ means ignore escape characters, meaning \ is treated as a regular character.

--
Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #6
That's true... been too long on vacation I guess :)
Arild

"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:opsb5ph6vjklbvpo@morten_x.edunord...

or prefix with @ character:

string comando = @"OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK = 'c:\Rendas.dat_bal'"";

No, @ means ignore escape characters, meaning \ is treated as a regular

character.
--
Happy coding!
Morten Wennevik [C# MVP]

Nov 16 '05 #7
OK Problem resolved

Thanks to everybody

"Shiva" <sh******@online.excite.com> escreveu na mensagem
news:eT**************@TK2MSFTNGP11.phx.gbl...
Escape embedded " (double-quote) characters using '\'.

string comando = "OSQL -Usa -Psa -n -Q \"BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bak'\"";
"Tiago Costa" <aa***@aaaa.pt> wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
I have a string that need to have the " char inside, but this give me an
error: end of the sring, how can i make the " a char of the string?

string comando = "OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bak'"";


Nov 16 '05 #8
yeah this is correct
Andy

"Shiva" wrote:
Escape embedded " (double-quote) characters using '\'.

string comando = "OSQL -Usa -Psa -n -Q \"BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bak'\"";
"Tiago Costa" <aa***@aaaa.pt> wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
I have a string that need to have the " char inside, but this give me an
error: end of the sring, how can i make the " a char of the string?

string comando = "OSQL -Usa -Psa -n -Q "BACKUP DATABASE Rendas TO DISK =
'c:\Rendas.dat_bak'"";



Nov 16 '05 #9

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

Similar topics

2
by: Senthoorkumaran Punniamoorthy | last post by:
I am printing these information. print string.lower(info_res) print string.lower(md5sum(f_md5)) print len(string.lower(info_res)) print len(string.lower(md5sum(f_md5))) print...
6
by: Gaurav | last post by:
Hello, I am using visual c++ 6 and i am having problems with string to work. ******** Here is the program project.cpp********* #include <iostream.h> #include <string> #include "stdafx.h"
9
by: David Carter-Hitchin | last post by:
Hi, I'm not very experienced with c++ so I'm sure this is something obvious that is easily solved, but for the life of me I can't seem to figure it out. I'd be very grateful for some...
1
by: Marco Gerlach | last post by:
Hello, on one of our customers servers we get following error on first ASPX-page: An error occurred while try to load the string resources (GetModuleHandle failed with error -2147023888) ...
3
by: Justnew | last post by:
Hei All Can some body help me here: I have a database name Customers, I a trying to connect to SQL server through vb.net using asp.net webform. I want to connect to the server programatically...
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
13
by: Freaker85 | last post by:
Hello, I am new at programming in C and I am searching a manner to parse a string into an integer. I know how to do it in Java, but that doesn't work in C ;o) I searched the internet but I...
0
by: hudhuhandhu | last post by:
have got an error which says Input string was not in a correct format. as follows.. Description: An unhandled exception occurred during the execution of the current web request. Please review the...
6
by: Arnshea | last post by:
(apologies for the crosspost) I'm working with an MFC based COM object. From C# I'd like to be able to call a method on the COM object that takes a string array and modifies the contents. Is...
8
by: drjay1627 | last post by:
hello, This is my 1st post here! *welcome drjay* Thanks! I look answering questions and getting answers to other! Now that we got that out of the way. I'm trying to read in a string and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.