Bonjour,
voici mon programme :
Dim nom As String
Dim pnom As String
Dim civ As String
Dim tel As String
Dim fax As String
Dim etab As String
Try
'Create a Connection object.
myConn = New SqlConnection("Data Source=TIPHAINE\SQLEXPRESS;Initial Catalog=Ciageofficent1;Integrated Security=True")
'Create a Command object.
myCmd = myConn.CreateCommand
myCmd.CommandText "select distinct Contact.Nom, Contact.Prenom, Contact.Civilite, Adresse.Tel, Adresse.Fax, Etablissement.Etablissement from Contact, Adr_Contact, Adresse, Etablissement where Contact.Contact_Id Adr_Contact.Contact_Id and Adr_Contact.Adresse_Id=Adresse.Adresse_Id and Adresse.Adresse_Id=Etablissement.Adresse_ID and Contact.Fonc_Id=39 and Contact.Contact_Id NOT IN (Select Contact_Id from Dossier where Dte_Ouverture >= dateadd(month,-6,getdate()) and Dte_Ouverture <= dateadd(month,-12,getdate()) ) order by Contact.Nom, Contact.Prenom asc;"
'Open the connection.
myConn.Open()
myReader = myCmd.ExecuteReader()
'Concatenate the query result into a string.
Do While myReader.Read
nom = Trim$(myReader.GetString(0))
pnom = Trim$(myReader.GetString(1))
civ = Trim$(myReader.GetString(2))
tel = Trim$(myReader.GetString(3))
fax = Trim$(myReader.GetString(4))
etab = Trim$(myReader.GetString(5))
results = results & nom & ";" & pnom & ";" & civ & ";" & tel & ";" & fax & ";" & etab & "."
Loop
'Close the reader and the database connection.
myReader.Close()
myConn.Close()
Dim cMsg As String
cMsg = ""
cMsg = "Bonjour"
cMsg = cMsg & "
" & results
EnvoiMail("tgauthier@ciage.fr", "Etude maillard : Notaire inactif", cMsg, "tgauthier@ciage.fr")
Console.WriteLine("Notaire inactif envoyés")
Catch
Console.WriteLine("Erreur dans le traitement : " & ErrorToString())
End Try
lors de l’exécution j'ai une erreur dans le traitement qui me dit que "Erreur dans le traitement : les données sont null. cette méthode ou propriété ne peut pas être appelée sur des valeurs null"
je ne comprend pas d'ou sa vient
merci de vos réponses