Ciao ragazzi,
in un'applicazione web 4.0 con database sql compact 4,
non riesco a inserire un campo ntext con una lunghezza superiore i 4000 caratteri.
L'errore è @Testo_News: String truncation: max=4000, len=4706
Ecco il codice che uso:
codice:
Public Function news_update_cont(Id_News As Integer, Titolo_News As String, Testo_News As String, Immagine As String, Preview As String) As Object
Dim Database As New OstHELLO.common.database
Dim ConnectionString As String = Database.ConnectionString
Dim Conn As New SqlCeConnection(ConnectionString)
Dim Cmd As SqlCeCommand
Dim P As SqlCeParameter
sql1 = "UPDATE News SET titolo_News=@Titolo_News, Testo_News=@Testo_News, Immagine=@Immagine, Preview=@Preview WHERE Id_News=@Id_News"
Cmd = New SqlCeCommand(sql1, Conn)
P = Cmd.Parameters.Add("@titolo_News", SqlDbType.NVarChar)
P.Value = common_utility.scrivi_testo(Titolo_News)
P = Cmd.Parameters.Add("@Immagine", SqlDbType.NVarChar)
P.Value = Immagine
P = Cmd.Parameters.Add("@Id_News", SqlDbType.Int)
P.Value = Id_News
P = Cmd.Parameters.Add("@Preview", SqlDbType.NVarChar)
P.Value = common_utility.scrivi_testo(Preview)
P = Cmd.Parameters.Add("@Testo_News", SqlDbType.NText)
P.Value = common_utility.scrivi_testo(Testo_News)
Try
Cmd.Connection.Open()
Cmd.ExecuteNonQuery()
Cmd.Connection.Close()
Catch ex As Exception
Valore = "news_update_cont Exception: " & ex.ToString
Finally
Valore = ""
End Try
Return Valore
End Function