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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:34:41+00:00 2026-06-06T04:34:41+00:00

I am using asp.net for my project , and I am using the following

  • 0

I am using asp.net for my project , and I am using the following code , but its not working correctly

 SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=E:\\WEB_PROJECT\\App_Data\\ASPNETDB.MDF;Integrated Security=True;User Instance=True");
 SqlCommand cmd = new SqlCommand();
 cmd.Connection = con;
 con.Open();
 cmd.CommandText = "UPDATE info SET fname = @fn, lname = @fl, phone= @ph, recoveryq=@rq, recoverya=@ra WHERE username = @un";  

 cmd.Parameters.AddWithValue("fn", TextBox3.Text);
 cmd.Parameters.AddWithValue("fl", TextBox4.Text);
 cmd.Parameters.AddWithValue("ph", TextBox5.Text);
 cmd.Parameters.AddWithValue("rq",TextBox6.Text);
 cmd.Parameters.AddWithValue("ra",TextBox2.Text);
 cmd.Parameters.AddWithValue("un",line);        
 cmd.ExecuteNonQuery();
 con.Close();

Advice plzz i m confused !!! 🙁

  • 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-06T04:34:43+00:00Added an answer on June 6, 2026 at 4:34 am

    As I’ve said before on this site – the whole User Instance and AttachDbFileName= approach is flawed – at best! Visual Studio will be copying around the .mdf file and most likely, your UPDATE works just fine – but you’re just looking at the wrong .mdf file in the end!

    If you want to stick with this approach, then try putting a breakpoint on the con.Close() call – and then inspect the .mdf file with SQL Server Mgmt Studio Express – I’m almost certain your data is there.

    The real solution in my opinion would be to

    1. install SQL Server Express (and you’ve already done that anyway)

    2. install SQL Server Management Studio Express

    3. create your database in SSMS Express, give it a logical name (e.g. ASPNETDB)

    4. connect to it using its logical database name (given when you create it on the server) – and don’t mess around with physical database files and user instances. In that case, your connection string would be something like:

      Data Source=.\\SQLEXPRESS;Database=ASPNETDB;Integrated Security=True
      

      and everything else is exactly the same as before…

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

Sidebar

Related Questions

I am working on a project in ASP.NET MVC using EF4 Code-First for the
I am currently using ASP.NET MVC1 in my project but now i am planing
I am working on an ASP.NET project and I am using Google Maps in
We are working on a ASP.NET project and we are using the resx files
i'm using jquery in report section in my asp.net mvc project.But i had problem
I'm starting a new web project using ASP.NET Webforms + EF4. I'm trying to
I have created a new MVC2 project using the ASP.NET MVC2 Web Application, which
I'm working on asp.net web project. When I run the project, It works correctly.
I've come across a strange problem with a ASP.net MVC project. the following code
I am working on a project with the following conditions: Visual Studio 2010 ASP.NET

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.