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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:31:03+00:00 2026-05-26T06:31:03+00:00

I have a local project where I am trying to input data from an

  • 0

I have a local project where I am trying to input data from an ASP:textbox to a database.

On building I get the following…

“Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed.“

I’m a little puzzled here, I have checked the database and it is active with the credentials i am trying to connect with.

Here is the code behind
C#

    namespace OSQARv0._1
{
    public partial class new_questionnaire : System.Web.UI.Page
    {
        SqlDataAdapter da = new SqlDataAdapter();
        SqlConnection sqlcon = new SqlConnection(@"user id=*myuserid*;"+"password=*mypassword*;"+"Data Source=mssql.dev-works.co.uk;User Instance=True;"+"Database=devworks_osqar"+"Trusted_Connection=true;");

        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Create_Click(object sender, EventArgs e)
        {
            DataBinder ds = new DataBinder();
            sqlcon.Open();
            SqlCommand sqlcmd = new SqlCommand("INSERT INTO QUESTIONNAIRES (QuestionnaireName) VALUES ('"+qnrName.Text+"')");
            sqlcmd.Parameters.AddWithValue("@Name", qnrName.Text);

            sqlcmd.ExecuteNonQuery();

            sqlcon.Close();
        }
    }
}

Any help would be much appreciated.

Edited code behind (read commment below)
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

namespace OSQARv0._1
{
    public partial class new_questionnaire : System.Web.UI.Page
    { 
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        private string myConnectionString;
        private SqlConnection myConn;
        public new_questionnaire()
        {
            myConn = new SqlConnection();
            myConnectionString += "Data Source=mssql.database.co.uk; Initial Catalog=devworks_osqar;User ID=myusername;Password=mypassword";
        }

        protected void Create_Click(object sender, EventArgs e)
        {
            //DataBinder ds = new DataBinder();
            SqlCommand sqlcmd = new SqlCommand("INSERT INTO QUESTIONNAIRES (QuestionnaireName) VALUES ('"+qnrName.Text+"')");
            sqlcmd.CommandType = CommandType.StoredProcedure;
            sqlcmd.Parameters.AddWithValue("@Name", qnrName.Text);
            insert(sqlcmd);

        }
        private void insert(SqlCommand myCommand)
        {
            myConn.Open();
            myCommand.ExecuteNonQuery();
            myConn.Close();
        }
    }
}
  • 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-26T06:31:03+00:00Added an answer on May 26, 2026 at 6:31 am

    Fix error “Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance.”

    Content from link pasted and altered below in case reference site is removed in the future:

    Step 1.

    Enabling User Instances on your SQL Server installation
    First we are gonna make sure we have enabled User Instances for SQL Server installation.

    Go to Query Window in SQL Server Management Studio and type this:

    exec sp_configure 'user instances enabled', 1.
    Go
    Reconfigure
    

    Run this query and then restart the SQL Server.

    Step 2.

    Deleting old files
    Now we need to delete any old User Instances.
    Go to your C drive and find and completely DELETE this path (and all files inside):

    C:\Documents and Settings\ YOUR_USERNAME \Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

    (Dont forget to replace the bold text in the path with your current username (if you are not sure just go to C:\Documents and Settings\ path to figure it out).

    After deleting this dir you can go to Visual Studio, create ASP.NET WebSite and click on your App_Data folder and choose Add New Item and then choose SQL Server Database and it should work!!!

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

Sidebar

Related Questions

I have checked out files from my svn repository to a local project folder.
I have a ASP.NET project, in which I have a method with 10 local
I have a project I checked out in Kohana and I'm trying to get
I have a Java project I am building with Maven. I am now trying
I am doing a project with VS2010 using C#. I have a local database
I have a rails project and keep getting the following error when trying to
I am trying get my first simple project in rails to run. I have
I am using git for windows to manage a local project. I have two
I'm working on a project with couple others. We all have local copies of
I have some local changes to an open source project which uses Subversion as

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.