Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 185301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:26:45+00:00 2026-05-11T15:26:45+00:00

I am trying to make an RSS Feed with asp.net,sql and xml. I am

  • 0

I am trying to make an RSS Feed with asp.net,sql and xml. I am getting an error

Compiler Error Message: CS0103: The name ‘MyConnString’ does not exist in the current context’ on line 22 ‘SqlConnection objConnection = new SqlConnection(‘MyConnString’);

My web config contains

<connectionStrings>     <add name='MyConnString' connectionString='      providerName='System.Data.SqlClient' />   </connectionStrings> 

Here is the code

<%@ Page Language='C#' MasterPageFile='ContentMasterPage.master' Debug='true' %>  <%@ Import Namespace='System.Xml'%> <%@ Import Namespace='System.Data' %> <%@ Import Namespace='System.Data.SqlClient' %>  <script runat='server'>     void Page_load(object sender, System.EventArgs e)     {         Response.Clear();         Response.ContentType = 'text/xml';         XmlTextWriter objX = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);         objX.WriteStartDocument();         objX.WriteStartElement('rss');         objX.WriteAttributeString('version', '2.0');         objX.WriteElementString('title', 'News');         objX.WriteElementString('link', 'http://news.ca/news.aspx');         objX.WriteElementString('description', 'The latest headlines');         objX.WriteElementString('copyright', '(c)2009, News Club, All rights reserved.');         objX.WriteElementString('ttl', '5');         SqlConnection objConnection = new SqlConnection('MyConnString');         objConnection.Open();         string sql = 'SELECT TOP 5 Title, Description, ArticleID, DatePulished FROM articles ORDER BY DatePublished DESC';         SqlCommand objCommand = new SqlCommand(sql, objConnection);         SqlDataReader objReader = objCommand.ExecuteReader();         while (objReader.Read())         {             objX.WriteStartElement('item');             objX.WriteElementString('title', objReader.GetString(0));             objX.WriteElementString('description', objReader.GetString(1));             objX.WriteElementString('link', ('http://news.ca/GetArticle.aspx?id=' + objReader.GetInt32(2).ToString()));             objX.WriteElementString('pubDate', objReader.GetDateTime(3).ToString('R'));             objX.WriteEndElement();         }         objReader.Close();         objConnection.Close();         objX.WriteEndElement();         objX.WriteEndElement();         objX.WriteEndDocument();         objX.Flush();         objX.Close();         Response.End();     } </script> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:26:46+00:00Added an answer on May 11, 2026 at 3:26 pm
    SqlConnection objConnection = new SqlConnection('MyConnString'); 

    This is the line that the compiler is having a difficult time with. Did you replace your actually connection string with ‘MyConnString’ or is MyConnString supposed to be a string value on the page?

    I have a similar line of code in my app:

    SqlConnection oConn= new SqlConnection(_connString); 

    You can also get this value from the Web.Config

    SqlConnection oConn = new SqlConnection(ConfigurationManager.ConnectionStrings['MyConnString'].ConnectionString); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a webcomic RSS feed with Django, but I can't put
I'm trying make some stuff in jQuery using ASP.NET. But the ID from runat=server
I am trying to make a request to an RSS feed that requires a
I’m trying to make an RSS subscribers counter using PHP and don’t know where
Trying to make a custom :confirm message for a rails form that returns data
I am trying to make a basic webclient call to get an xml stream
I am trying to parse an rss feed that is using the well formed
I'm trying to format a date from a RSS feed: Mon, 27 Feb 2012
I'm trying to put together a simple RSS feed reader in windows phone 7
I am trying to read two Rss feed urls at regular intervals and display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.