0

i have a problem in inserting the listbox value into mysql database in vb 2008 i.e

if i select a video file i.e D:\videos\video1.mpg and add a msgbox() event before inserting into data base it shows the exact path i.e D:\videos\video1.mpg but when i check my database it shows me as D:videosvideo1.mpg how can i solve that

2 Answers 2

1

Within MySQL string values the backslash is interpreted as an escape character. The following escape sequences have special meaning to MySQL: \0, \', \", \b, \n, \r, \t, \z, \, \%, \_. Any other character preceeded by a backslash is just replaced with that character. So in your example: \v is not a valid escape sequence so it is replaced with just "v" when it is stored. You should alter your path values to contain the "\" sequence to actually store a backslash. Example: D:\\videos\\video1.mpg

Sign up to request clarification or add additional context in comments.

2 Comments

could you please let me know how can i insert double slash auto matically because i am using a listbox to add video file and than i have a button to insert all listbox items into database please let me know how can i add double back slashes...??
Without actually seeing your listbox to database code it's kind of hard to comment. But assuming that you are using some form of a loop to iterate through your listbox contents. As you pull each string value out of the list, use the Replace method before you insert into the database. Example: NewFileName = OldFileName.Replace("\", "\\")
0

try to insert path with two backslash signs, for example "D:\\videos\\video1.mpg" into database.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.