CommandText trop longue !

ydysance Messages postés 1 Date d'inscription mercredi 20 septembre 2006 Statut Membre Dernière intervention 10 octobre 2006 - 10 oct. 2006 à 16:32
Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 - 11 oct. 2006 à 10:09
Hello,

I have an UPDATE  query that is too long and I have got an error message which said that the string is truncated.
Here is my query:

Try
                Dim Fichier As String
                Fichier = CType(Dts.Variables("Utilisateur::FICHIER").Value, String)
                myCommand.CommandText = " UPDATE DTL_CHARG SET FICHIER= '" + Trim(Fichier) + "' WHERE IDCHARGEMENT= '" + Trim(Idchargement.ToString) + "'"
                myReader = myCommand.ExecuteReader()

            Catch ex As Exception
                MsgBox("Erreur UPDATE DTL_CHARG (FICHIER)! Message d'erreur:  " + ex.Message)
            End Try
            myReader.Close()

Fichier is a variable that receives the SSIS variable value (has a string value which is a directory name + a file name, this string is very long and exceed the length limit of the CommandText).

What should I do ?
Thank you for your help

2 réponses

nhervagault Messages postés 6063 Date d'inscription dimanche 13 avril 2003 Statut Membre Dernière intervention 15 juillet 2011 37
10 oct. 2006 à 17:01
Hello

For this problem you can use the ado parameters.

I think that's resolve this.

http://www.knowdotnet.com/articles/dynamicsqlparameters.html

Bye
0
Renfield Messages postés 17287 Date d'inscription mercredi 2 janvier 2002 Statut Modérateur Dernière intervention 27 septembre 2021 74
11 oct. 2006 à 10:09
I just think that you need to grow up the 'FICHIER' field in your database...

Set its size to 255 and you sure won't have this problem

Renfield
Admin CodeS-SourceS- MVP Visual Basic
0
Rejoignez-nous