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 6473351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:27:22+00:00 2026-05-25T06:27:22+00:00

namespace extractDB { class ConsoleApp2 { static void Main(string[] args) { string dog =fancy;

  • 0
namespace extractDB
{
class ConsoleApp2
{
    static void Main(string[] args)
    {
        string dog ="fancy";
        string shep = "shepherd";
        Add _add = new Add();
        _add.Ex(45, dog, shep);
    }
}
class Add
{
    public void Ex(int weight, string name, string breed)
    {

  using (SqlConnection con = new SqlConnection(extractDB.Properties.Settings.MasterConnectionString))
        {
            con.Open();
            try
            {
  using (SqlCommand command = new SqlCommand("INSERT INTO format(@Weight,@Name,@breed)", con))
                {
                    command.Parameters.Add(new SqlParameter("Weight", weight));
                    command.Parameters.Add(new SqlParameter("Name", name));
                    command.Parameters.Add(new SqlParameter("Breed", breed));
                    command.ExecuteNonQuery();
                }
            }

            catch
            {
                Console.WriteLine("count not inserted");
            }

        }

      }

  }
}

I’m getting an error message because of “extractDB.Properties.Settings.MasterConnectionString.”

I checked in the app.config and settings.settings files and that’s the string app.config gives me. I even tried adding in

static void Ex(int weight, string name, string breed)

but it doesn’t get rid of the error message.

So yeah kind of lost on this one.

  • 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. Editorial Team
    Editorial Team
    2026-05-25T06:27:23+00:00Added an answer on May 25, 2026 at 6:27 am

    The conventional way of using configuration files to store Database Connection Strings would be to use the <connectionStrings> element at the root of your web or app.config file:

    <configuration>
        <connectionStrings>
          <add 
            name="NorthwindConnectionString" 
            connectionString="Data Source=serverName;Initial 
            Catalog=Northwind;Persist Security Info=True;User 
            ID=userName;Password=password"
            providerName="System.Data.SqlClient"
          />
        </connectionStrings>
    <configuration> 
    

    You can then use the following code to access the connection string:

    string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;
    

    ..instead of what you have:

    extractDB.Properties.Settings.MasterConnectionString
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using namespace std; class A { public: A() {} ~A() {} map<int, string*>& getMap()
After namespace , class , struct , enum , for , foreach , while
I am getting NullReferenceException error on _attr.Append(xmlNode.Attributes[name]);. namespace SMAS { class Profiles { private
I have the following classes: public class Person { public String FirstName { set;
In the following code : #include <iostream> #include <fstream> #include <string> using namespace std;
Namespace are pretty cool: with them, you can organize your libraries and you can
namespace ValueType { enum Enum { Boolean = 0, Float = 1, Double, SInt
in the System.Linq namespace, we can now extend our IEnumerable's to have the Any()
I place using namespace in a view code behind but i can't call any
My schema specifies a namespace, but the documents don't. What's the simplest way to

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.