AnantLabs / codesmith

Automatically exported from code.google.com/p/codesmith
1 stars 0 forks source link

Incorrect select statement is returned in the Parameterized SQL Child Update template. #440

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
            const string commandText = "UPDATE [dbo].[Category]  SET [CategoryId] = @p_CategoryId, [Name] = @p_Name, [Descn] = @p_Descn WHERE [CategoryId] = @p_OriginalCategoryId AND [TheVersion] = @p_TheVersion; SELECT [TheVersion] FROM [dbo].[Category] WHERE CategoryId = @p_CategoryId";
            using(SqlCommand command = new SqlCommand(commandText, connection))
            {
                command.Parameters.AddWithValue("@p_OriginalCategoryId", this.OriginalCategoryId);
                command.Parameters.AddWithValue("@p_CategoryId", this.CategoryId);
                command.Parameters.AddWithValue("@p_Name", ADOHelper.NullCheck(this.Name));
                command.Parameters.AddWithValue("@p_Descn", ADOHelper.NullCheck(this.Description));
                command.Parameters.AddWithValue("@p_TheVersion", SqlDbType.Timestamp);
                command.Parameters["@p_TheVersion"].Value = this.TheVersion;
                command.Parameters["@p_TheVersion"].Direction = ParameterDirection.InputOutput;

                using(var reader = new SafeDataReader(command.ExecuteReader()))
                {
                    if(reader.Read())
                    {
                        TheVersion = ADOHelper.GetBytes(reader, "TheVersion");
                        //  Update non-identity primary key value.
                        //LoadProperty(_categoryIdProperty, reader.GetString("CategoryId"));
                    }
                }

Original issue reported on code.google.com by bniemyjski on 1 Jul 2010 at 8:28

GoogleCodeExporter commented 9 years ago
This issue was updated by revision r1787.

Fixed Issue 440: Incorrect select statement is returned in the Parameterized 
SQL Child Update template.

Original comment by bniemyjski on 8 Jul 2010 at 11:46

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 8 Jul 2010 at 11:46