Sql Server Database doesn’t updated

20 pts.
SQL Server 2005
SQL Server database
Hello, iam developing an ASP.NET2 Application using SQL Server2005 database, i have updated data from a web page ,the data updated successfuly and displays a meessage that itis updated successfuly , but when i refresh the page or when i display the data from the database ,i found that no changes happend to the database!!!!. public static int Update_NC(long nc_id,string name,int duration,int type_id,int route_id,int comapany_id,int listing_id,string breif_desc,string notes,bool display_or_not) { cmd = new SqlCommand(); cmd.CommandText = @"UPDATE NileCruises SET NileCruise_Name ='" + name + "', NileCruise_Duration =" + duration + ", NileCruise_type_id =" + type_id + ", breif_description ='" + breif_desc + "', Route_id =" + route_id + ", Company_id =" + comapany_id + ", NileCruise_Listing_id =" + listing_id + ", NileCruise_Notes ='" + notes + "',Date='" + DateTime.Now.Date.ToShortDateString() + "',Display ='" + display_or_not + "' WHERE (NileCruise_id =" + nc_id + ")"; SqlConnection con = new SqlConnection(ConnectionString); if (con.State != ConnectionState.Open) { con.Open(); } cmd.Connection = con; int i = cmd.ExecuteNonQuery(); con.Close(); return i; } please help me!. Thank you, Abu_Solyman

Answer Wiki

Thanks. We'll let you know when a new response is added.

From what I can see your .NET code looks correct.

Start SQL Profiler and monitor the commands which are running on the SQL Server and see if you can see the update command being run. This will give you the exact command which is being run so you can see if any of the values are not being set correctly.

Are you sure that the .NET code isn’t throwing an error message?

Discuss This Question: 2  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Denny Cherry
    Check out my SQL Server blog "SQL Server with Mr Denny" for more SQL Server information.
    69,005 pointsBadges:
  • AbuSolyman
    i checked the .NET code ,it didn't throw any error massages,but when i use the SQL Profiler is saw that the TextBoxes doesn't update their values when i change the text displayed on it and also with the DropDownList , the Editor , and the CheckBox. all the values of the doesn't updated when i change it !!. what should i do in this case?
    20 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: