Parcourir un fichier text
Bonjour,
Je travail sur un fichier text dont y'a des emails veus depuis outlook, je voudrais pouvoir les parcourir et les inserer dans une table sous sql,
mon fichier et sous forme:
Citation:
From: xx.xx[xx.xx@ee.com]
Sent: Thursday, 16 June, 2011 12:50 PM
To:
yy.yy@yy.com
Subject: FW: How to bridge to the Cloud: Take the first steps with Citrix
message
From: yy.yy[mailto:yy.yy@ee.com]
Sent: Thursday, 16 June, 2011 1:31 PM
To: 'xx.xx'
Subject: RE: How to bridge to the Cloud: Take the first steps with Citrix
message
From: xx.xx[mailto:xx.xx@ee.com]
Sent: Thursday, June 16, 2011 11:10:36 AM 2011-06-3020 AM
To:
yy.yy@ee.com
Cc:
kk.kk@ee.com
Bcc:
mm.mm@ee.com
Subject: FW: How to bridge to the Cloud: Take the first steps with Citrix
j'ai pu faire ca mais au niveau de Body il y'a un soucci, voila mon code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
lines = System.IO.File.ReadAllLines(cheSave)
For Each line As String In lines
compt = lines.Length - 1
If line.Contains("From:") Then
fromm = line
End If
If line.Contains("Sent:") Or line.Contains("Date:") Then
sent = line
End If
If line.Contains("To:") Then
to1 = line
End If
If line.Contains("Cc:") Then
cc = line
End If
If line.Contains("Bcc:") Then
bcc = line
End If
If line.Contains("Subject:") Then
subj = line
End If
body = body & line
Dim cominsert As New SqlCommand("insert into Email values('" & subj.Replace("Subject:", "") & "','" & body.Replace("Subject:", "") & "','" & sent.Replace("Sent:", "").Replace("Date:", "") & "',0,0,0,0,0)", m_con)
' cominsert.ExecuteNonQuery()
Next |
pour etre plus clair comment puis-je a chaque ligne de "from" inserer une ligne dans la table?? Merci de votre aide.