RSS Forums RSS
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 6052 | Replies: 2
Reply
Join Date: Apr 2005
Posts: 1
Reputation: kerberos is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
kerberos kerberos is offline Offline
Newbie Poster

database string in web.config not working

  #1  
May 4th, 2005
hello, i just started to code aspx, but i found troubles adding the connection string in the web.config
i was trying to code the "populate the listbox" tutorial, and in the part of pasting the connection string in the above mentioned file, i'm getting this error
"Only elements allowed"
The debug points to that line in the web.config
Thanks in advance, this web is cool because the tutorials are so well explained, which is hard to find on other sites for noobies like me.
thanks thanks thanks !
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: Tennessee
Posts: 18
Reputation: millers_35 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
millers_35 millers_35 is offline Offline
Newbie Poster

Re: database string in web.config not working

  #2  
May 5th, 2005
Here might be one solution to help you out. This is not my work I found it elsewhere.

In the web.config file, add the following section

<configuration>
<appSettings file="app.config"></appSettings>
</configuration>

In a new file, add the following and save it as app.cfg


<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<add key="conn" value="Data Source=localhost;Integrated Security=SSPI; database=YourDB" />
</appSettings> 


Hope this helps.

Miller
Reply With Quote  
Join Date: Apr 2007
Posts: 1
Reputation: webbsk is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
webbsk webbsk is offline Offline
Newbie Poster

Solution Re: database string in web.config not working

  #3  
Apr 30th, 2007
I know the original poster has probably long since solved their problem, but I thought I'd answer for anyone coming along after who faces a similar exception and is confused. Especially since both of the original replies above are either wrong or comment spam.

Now, what this exception generally means is that the XML in the App.Config file is ill-formed. That is, you have probably put something in there that shouldn't be there or something like that. For instance, when I got this error recently, it was because I had accidently put a semi-colon at the end of a key.

I'm not saying this is going to be the answer all the time, but if you get this sort of error, the first thing I would do is go back and check my App.Config file to ensure that you haven't thrown in an extra punctuation mark or the like. Good luck!
Last edited by webbsk : Apr 30th, 2007 at 4:20 pm.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:57 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC