|
自分なりに下記までやってみたんですが ********* の部分をどうすればいいのか分かりません。 根本的に何か間違っているのでしょうか? 勉強不足で申し訳ございませんが、ご教授お願いいたします。
(投稿時にストアが引っかかったので、カタカナ表記にしました)
Dim zipStream As New ZipOutputStream(New ByteArrayOutputStream)
Dim setting As ConnectionStringSettings = ConfigurationManager.ConnectionStrings("aaaaa") Dim factory As DbProviderFactory = DbProviderFactories.GetFactory(setting.ProviderName)
Using db As DbConnection = factory.CreateConnection()
db.ConnectionString = setting.ConnectionString
Dim comm As DbCommand = factory.CreateCommand() comm.CommandText = "SELECT file_name, data_binary FROM table1 WHERE id IN (1,2,3)"
comm.Connection = db db.Open()
Dim reader As DbDataReader = comm.ExecuteReader() Do While reader.Read()
Dim zEntry As New ZipEntry(reader(0).ToString()) zEntry.setMethod(ZipOutputStream.DEFLATED) zipStream.putNextEntry(zEntry) zipStream.write(reader(1), 0, reader(1).Length) zipStream.closeEntry()
Loop
reader.Close() zipStream.flush()
Dim cnStr As String = System.Configuration.ConfigurationManager.ConnectionStrings("aaaaa").ConnectionString Using connection As New SqlConnection(cnStr)
Try
Dim command As New SqlCommand("sp_aaa", connection) command.CommandType = Data.CommandType.ストアドProcedure command.Parameters.Add(New SqlParameter("@file_name", Data.SqlDbType.NVarChar)).Value = "ddd.zip" command.Parameters.Add(New SqlParameter("@data_binary", Data.SqlDbType.Binary)).Value = ********* connection.Open()
command.ExecuteNonQuery()
|