julianvienna
New Member
I want to know what (if any) is wrong with the below stored procedure for updating address:I have also given my database image to get a clear idea....\[code\]ALTER PROCEDURE [dbo].[usp_UpdateAddress] (@OriginalEmail nvarchar(50), @FirstName varchar(50), @LastName varchar(50), @Country_ID int, @AddressLine1 varchar(50), @AddressLine2 varchar(50), @AddressLine3 varchar(50), @Telephone varchar(50), @Email nvarchar(50), @City varchar(50), @State_ID int, @PostalCode varchar(50), @Mobile varchar(50))ASBEGIN DECLARE @User_ID INT SELECT @User_ID = ID FROM AUser Where Email = @OriginalEmail UPDATE [AUserAddress] SET [AUser_ID] = @User_ID, [FirstName] = @FirstName, [LastName] = @LastName, [Country_ID] = @Country_ID, [AddressLine1] = @AddressLine1, [AddressLine2] = @AddressLine2, [AddressLine3] = @AddressLine3, [Telephone] = @Telephone, = @Email, [City] = @City, [State_ID] = @State_ID, [PostalCode] = @PostalCode, [Mobile] = @Mobile WHERE Email = @OriginalEmailEND\[/code\]Called from C#: \[code\]private void UpdateAddress(){ try { string strSession = objGetSession.GetEmailFromSession(); con.Open(); SqlCommand sqlCmd = new SqlCommand("usp_UpdateAddress", con); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.Add("@OriginalEmail ", SqlDbType.NVarChar, 50).Value = http://stackoverflow.com/questions/15804021/strSession; sqlCmd.Parameters.Add("@FirstName", SqlDbType.VarChar, 50).Value = http://stackoverflow.com/questions/15804021/txtFirstName.Text; sqlCmd.Parameters.Add("@LastName", SqlDbType.VarChar, 50).Value = http://stackoverflow.com/questions/15804021/txtLastName.Text; sqlCmd.Parameters.Add("@AddressLine1", SqlDbType.VarChar, 50).Value = http://stackoverflow.com/questions/15804021/txtAddressLine1.Text; sqlCmd.Parameters.Add("@AddressLine2", SqlDbType.VarChar, 50).Value = http://stackoverflow.com/questions/15804021/txtAddressLine2.Text; sqlCmd.Parameters.Add("@AddressLine3", SqlDbType.VarChar, 50).Value = http://stackoverflow.com/questions/15804021/txtAddressLine3.Text; sqlCmd.Parameters.Add("@Telephone", SqlDbType.VarChar, 50).Value = http://stackoverflow.com/questions/15804021/txtTelephone.Text; sqlCmd.Parameters.Add("@Email", SqlDbType.NVarChar, 50).Value = http://stackoverflow.com/questions/15804021/txtEmailAddress.Text; sqlCmd.Parameters.Add("@Country_ID", SqlDbType.Int).Value = http://stackoverflow.com/questions/15804021/ddlCountry.SelectedItem.Value; sqlCmd.Parameters.Add("@City", SqlDbType.VarChar, 50).Value = http://stackoverflow.com/questions/15804021/txtCity.Text; sqlCmd.Parameters.Add("@State_ID", SqlDbType.Int).Value = http://stackoverflow.com/questions/15804021/ddlState.SelectedValue.ToString(); sqlCmd.Parameters.Add("@PostalCode", SqlDbType.VarChar, 50).Value = http://stackoverflow.com/questions/15804021/txtPostalCode.Text; sqlCmd.Parameters.Add("@Mobile", SqlDbType.VarChar, 50).Value = http://stackoverflow.com/questions/15804021/txtMobile.Text; sqlCmd.Connection = con; sqlCmd.ExecuteNonQuery(); con.Close(); mpeTest.Show(); Response.Write("<script> alert('Address Updated!') </script>"); } catch (Exception e) { Response.Write("An Error Occurred" + e); } }\[/code\][img]http://i.stack.imgur.com/g3dA5.png[/img]Is the stored procedure not executing? Debugging shows that in Update Address() it does take the new value but when execution is completed, the database is not updated...