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

  • SEARCH
  • Home
  • 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

Trying to make a generic PL/SQL procedure to export data in specific XML format,
Trying to make a MySQL-based application support MS SQL, I ran into the following
Trying to make a make generic select control that I can dynamically add elements
Trying to make a web service call to an HTTPS endpoint in my Silverlight
I'm trying to make the case for click-once and smart client development but my
I'm trying to make a data bound column invisible after data binding, because it
I'm trying to make a context menu for a control that is linked to
I am trying to make a div, that when you click it turns into
I am trying to make a JTable that has column spans available. Specifically, I
I am trying to make an Outlook 2003 add-in using Visual Studio 2008 on

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.