Sql Server Database doesn't updated

Discussion in 'ASP.NET 2.0' started by Abu_Solyman, Oct 12, 2008.

  1. Hello,
    iam developing an ASP.NET2 ApplicationusingSQL 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
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    are you sure you are pointing to the correct database? check your connection string.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  3. i already checked the connection string and the database,
    and already checked the command text on sql server 2005 and it runs successfuly!!.
     

Share This Page