Hi Guys,
I am currently working on a vb project. What I am trying to do is reading a XML file and saving all the data in to the Access DB. Once this is done, I read the data from the access Db and display it in the required fields in VB form.

Issue is, when i store the value in the access, a weird character is assigned before and after the data. The character is a square box with question mark in it. Also the same character displays on the VB form as well

Please help me how can I remove these characters in VB.
I am using XML reader to read xml file and using VB 2008 version.


Thank you so much

Ashwin

Recommended Answers

All 6 Replies

I think you need to ignore the white spaces while reading from XML and storing in DB.

thank you so much Debasisdas
Could you please tell me the syntax to ignore the space while reading the xml...
EX : <name> abc xyz </name>

I just want to remove the space before abc and after xyz.. But i need to preserve the space between abc and xyz


Thank you
ashwin

1. Read what ever is in XML.
2. Clean up the data (in this case Trim should do) and store in DB.

Dim x As String = " abc xyz "
        x = x.TrimStart(" "c).TrimEnd(" "c)
        MsgBox(x)

If the above code from codeorder doesn't work you could use:

'given that xmlString is the variable holding 
'the string read from <name> abc xyz </name>

Dim newString as string = xmlString.Substring(1,xmlString.Length-2)

'store newString in DB

Thank you so much guys...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.