Re: Error when trying to save...

  •  09-20-2006, 3:19 PM

    Re: Error when trying to save...

    Here is the ASP.NET code:
                sDesc = Editor2.Text
                sDesc = Replace(sDesc, vbCrLf, "")
                If Len(sDesc) = 0 Then
                    sDesc = Chr(0)
                End If
                sDesc = Replace(sDesc, "<ul>", "<ul class='checkboxlist'>")
                sFilename = Replace(Filename.Value, "/", "\")
                If Len(sFilename) = 0 Then
                    sFilename = Chr(0)
                End If
                oConn.Open()
                With oCmd
                    .Parameters.Clear()
                    .Connection = oConn
                    .CommandType = Data.CommandType.StoredProcedure
                    .CommandText = "IatricWeb_update_news"
                    .Parameters.AddWithValue("@Title", Title.Text)
                    .Parameters.AddWithValue("@ShortDescription", Editor1.Text)
                    .Parameters.AddWithValue("@Description", sDesc)
                    .Parameters.AddWithValue("@Link", Link.Text)
                    .Parameters.AddWithValue("@Image", sFilename)
                    .Parameters.AddWithValue("@SubmitDate", NewsDate.Text)
                    If Feature.Checked = True Then
                        .Parameters.AddWithValue("@Feature", 1)
                    Else
                        .Parameters.AddWithValue("@Feature", 0)
                    End If
                    If Inactive.Checked = True Then
                        .Parameters.AddWithValue("@Inactive", 1)
                    Else
                        .Parameters.AddWithValue("@Inactive", 0)
                    End If
                    .Parameters.AddWithValue("@NewsID", NewsID.Value)
                    .ExecuteNonQuery()
                End With 
     
     
    Here is the SP: 
    CREATE PROCEDURE IatricWeb_update_news
    @Title varchar(50), @ShortDescription varchar(275), @Description varchar(8000),
    @Link varchar(250), @Image varchar(250), @SubmitDate datetime,
    @Feature bit, @Inactive bit, @NewsID int
    AS
    Update IatricWeb..TAB_News
    Set Title = @Title,
     ShortDescription = @ShortDescription,
     [Description] = @Description,
     Link = @Link,
     [Image] = @Image,
     [Date] = @SubmitDate,
     Feature = @Feature,
     Inactive = @Inactive
    Where NewsID = @NewsID
     
    I've also verified that the field in the SQL database has a datatype of varchar(8000).
View Complete Thread