2011年7月28日木曜日

→→→VBテキスト読み込み

Dim sCom As SqlCilent.SqlCommand
Dim sCn As SqlCilent.SqlConnection = New SqlCilent.SqlConnection()
scn.ConnectionString = "Data Source=.\SQLEXPRESS; AttachDbFileName = " &
                                 & My.Application.Info.DirectoryPath &
                                "****.mdf; Integrated Security=True; Connect TimeOut=30;
                               User Instance = True"
Try
      sCn.Open()
      sCom = New SqlCilent.SqlCommand
        ("BULK INSERT 読込 FROM 'C:\テキスト.txt' WITH (Fieldterminator = ',' ,
          rowterminator = '\n' )" , sCn)

      sCom.ExecuteNonQuery()
Catch ex As Exception
      MessageBox.Show( ex.Message )
End Try

sCn.Close()

0 件のコメント:

コメントを投稿