Wed Nov 05, 2008 6:21 pm
0618888888 KURNIA SEMARANG 86 63360
0619999999 HIAPEE WAHIDIN 105 95664
Dim strcontenttype = FileUpload1.PostedFile.ContentType
Dim ms As New System.IO.StreamReader
(FileUpload1.PostedFile.InputStream)
Dim strResult As String = ms.ReadToEnd()
Dim recStr() As String = strResult.Split("vbcrlf")
Dim recItem As String = ""
Dim nLoop As Integer = 0
Dim arRec(recStr.Length) As MyRecord
Dim nt As String
Dim nm As String
Dim kt As String
Dim id As String
Dim nom As Decimal
For nLoop = 0 To recStr.Length - 1
recItem = recStr(nLoop)
If recItem.Length > 106 Then
nt = recItem.Substring(0, 14)
nm = recItem.Substring(15, 23)
kt = recItem.Substring(24, 38)
id = recItem.Substring(39, 53)
nom = CType(recItem.Substring(54), Decimal)
Dim command As SqlCommand
Dim connection As New SqlConnection("Data
Source=xxx;Initial Catalog=xxxx;User ID=xxx; password=xxxx")
command = connection.CreateCommand
command.CommandText = "INSERT INTO xxxx
(aaa,bbb,ccc,ddd,eeee) VALUES ('" & recItem.Substring(0, 14) & "','"
& recItem.Substring(15, 23) & "','" & recItem.Substring(24, 38)
& "','" & recItem.Substring(39, 53) & "','" & CType(recItem.Substring
(54), Decimal) & "')"
connection.Open()
command.ExecuteNonQuery()
connection.Close()
End If
Next
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.