Solved

Read Connection string from xml file vb.net

Posted on 2014-11-13
4
474 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 500 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

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.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

688 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