VB.NET

Moderators: seancampbell
Number of threads: 4020
Number of posts: 10026

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
String Problem Posted by munirshahzad on 16 Feb 2006 at 12:33 AM
Hi,
if we have a single quote in the string then the whole string makes problem when we save that string in the Database.

Dim myString as String
myString = "Shahzad's Car is in the workshop."


Thanks.
Report
Re: String Problem Posted by jayeshiyer on 16 Feb 2006 at 2:00 AM
: Hi,
: if we have a single quote in the string then the whole string makes problem when we save that string in the Database.
:
:
: Dim myString as String
: myString = "Shahzad's Car is in the workshop."
: 

:
: Thanks.
:
I think you can solve the above problem by using the Replace function.
Replace(string,"'","''")
Thanks,
Jayesh.S
Report
Re: String Problem Posted by munirshahzad on 16 Feb 2006 at 2:54 AM
: : Hi,
: : if we have a single quote in the string then the whole string makes problem when we save that string in the Database.
: :
: :
: : Dim myString as String
: : myString = "Shahzad's Car is in the workshop."
: : 

: :
: : Thanks.
: :
: I think you can solve the above problem by using the Replace function.
: Replace(string,"'","''")
: Thanks,
: Jayesh.S
:
Thats a better solution but is there is any way to use single quote, because i want to save conversation between two or more persons and in this conversation single quote is used many times.
Thanks.

Report
Re: String Problem. Try character 39. Posted by DrMarten on 16 Feb 2006 at 4:34 AM
This message was edited by DrMarten at 2006-2-16 4:34:48

: Hi,
: if we have a single quote in the string then the whole string makes problem when we save that string in the Database.
:
:
: Dim myString as String
: myString = "Shahzad's Car is in the workshop."
: 

:
: Thanks.
:

==============================================


myString = "Shahzad" & CHR(39) & "s Car is in the workshop."


What problem does it give you in a database?
You could possibly use an array of type String like>


Dim carStatus(10) As String
'Counting in array i think starts at zero so you have 11 elements there.
carStatus(0)="Shahzad" & CHR(39) & "s Car is in the workshop."



Regards,

Dr M.






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.