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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:00:28+00:00 2026-06-07T00:00:28+00:00

I use the following function for insert the value in database through the stored

  • 0

I use the following function for insert the value in database through the stored procedure.but i have the exception in sqlConnection.Open();How to solve this?

  try
        {
            string dbConnectionString = "something";
            SqlConnection sqlConnection = new SqlConnection(dbConnectionString);
            SqlCommand command = new SqlCommand("sp_Test", sqlConnection);
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@id ", SqlDbType.Int).Value = TextBox1.Text;
            command.Parameters.AddWithValue("@FullName", SqlDbType.VarChar).Value = TextBox2.Text;
            sqlConnection.Open();
            command.ExecuteNonQuery();
            sqlConnection.Close();
        }
        catch (SqlException ex)
        {
            Console.WriteLine("SQL Error" + ex.Message.ToString());

        }
  • 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-06-07T00:00:29+00:00Added an answer on June 7, 2026 at 12:00 am

    Well, the error you are getting doesn’t really have anything to do with stored procedures, but I can answer the question of “how to solve this?” in the context of the exception you are getting.

    First, I hope you are not using “something” as the actual connection string to your sql server. You should be using a real connection string. Here are some various examples you can use to connect to SQLServer – http://www.connectionstrings.com/sql-server-2005

    Using the first example from the above url

    Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
    

    You’ll want to change “myServerAddress” to the ip address or host name of the server. This could be “localhost” or it could be another computer you have on the network. Change “myDataBase” to the name of the database you created, and make sure the name matches exactly as the database might be configured with case sensitivity. And finally change “myUsername” and “myPassword” to the user and password of the account you use to access the server under Sql Server Management Studio.

    Now, assuming you have actually done the above, here are some steps you can take to debug connection issues.

    1. Ping the computer – from and command prompt type “ping servername” where servername is the name or ip address of the server that runs SQL Server. If you don’t get a response from the server then you need to debug your local network.

    2. If the server is running locally try using “.” for the “myServerAddress” value. If it’s sqlserver express edition, use the express format – “.\SQLExpress” or “myServerAddress\SQLExpress”

    3. If SQL Server is running on another computer try each of the three links under the section “More Information” from this kb article – http://support.microsoft.com/kb/914277 That will ensure remote connections are supported.

    But the real issue is that you cannot connect to the database. I recommend searching for solutions to that problem first. Or perhaps supply more information about your setup here on SO in a different question.

    Hope that helps,
    -Marcus

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the following function to show controls on my form: class procedure TFormMain.FadeControls(ctrl:Array
i have to use the following function, to change the input's type <input class=input
I want to use the following js function to insert an image on a
I have the following code: public function createNewGuide($userID,$guideName) { $sql = INSERT INTO myTable(name,
I want to insert a value by using stored procedure in mssql. This is
I have a weird requirement which I need to use inside my Stored Procedure
I use the following function for decimal validation it was work fine in IE
I use the following function to rename thumbnails. For example, if I upload a
We use the following function to auto detect if we are on a machine
I tried to use the following function in order to set the div's position

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.