?
Solved

Read Connection string from xml file vb.net

Posted on 2014-11-13
4
Medium Priority
?
499 Views
Last Modified: 2014-11-18
The project runs fine with Line 12 below. But, with lines 9 and 11 it fails.

Question: Why line 9 is not reading the connection string? Is shows "nothing" via intelesens.

<?xml version="1.0" encoding="utf-8" ?>
<connection>
Data Source=.\SQLEXPRESS12;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=True;User Instance=True
</connection>


Protected Shared Function GetNWConString() As String

Dim xmlReader As New XmlTextReader("csNorthwind.xml")

Return xmlReader.ReadElementString("connection")
'Return "Data Source=.\SQLEXPRESS12;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=True;User Instance=True"
End Function

Open in new window

0
Comment
Question by:Mike Eghtebas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 34

Assisted Solution

by:it_saige
it_saige earned 2000 total points
ID: 40440155
Please provide the code used to build your xml reader object.

-saige-
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 40440189
Hi Saige,

I have typed it manually. I am not aware of utility that builds xml file like this.

Mike
0
 
LVL 34

Accepted Solution

by:
Mike Eghtebas earned 0 total points
ID: 40440262
"Copy if newer" did the rick. It was on "Do not copy".

Thanks,

Mike
0
 
LVL 34

Author Closing Comment

by:Mike Eghtebas
ID: 40449349
When I checked "Copy to Output Directory" I notice it was on "Do not Copy".
0

Featured Post

Quick Start: DOCKER

Sometimes you just need a Quick Start on a topic in order to begin using it.. this is just what you need to know to get up and running with Docker!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question