Code
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.IO;
namespace LoadImages
{
class LoadImages
{
string imageFileLocation = @"F:\kugoo";
string imageFilePrefix = "milk";
int numberImageFiles = 1;
string imageFileType = ".gif";
int maxImageSize = 10000;
SqlConnection conn = null;
SqlCommand cmd = null;
static void Main(string[] args)
{
LoadImages lg = new LoadImages();
Console.ReadKey();
}
void OpenConnection()
{
conn = new SqlConnection("Data Source=S013;Initial Catalog=test;Integrated Security=True");
conn.Open();
}
void CloseConnection()
{
conn.Close();
Console.WriteLine("Connection Closed!");
}
void CreateCommand()
{
cmd = new SqlCommand();
cmd.Connection = conn;
}
void ExecuteCommand()
{
int cmdResult;
cmd.CommandTextcmdText;
Console.WriteLine("Execute command");
Console.WriteLine(cmd.CommandText);
cmdResult = cmd.ExecuteNonQuery();
Console.WriteLine("ExecuteNonQuery return {0}",cmdResult);
}
void CreateImageTable()
{
ExecuteCommand(@"
create table imagetable
(
imagefile nvarchar(20),
imagedate varbinary(max)
)
");
}
void PrepareInsertImages()
{
cmd.CommandText = @"insert into imagetable values(@imagefile,@imagedata)";
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.IO;
namespace LoadImages
{
class LoadImages
{
string imageFileLocation = @"F:\kugoo";
string imageFilePrefix = "milk";
int numberImageFiles = 1;
string imageFileType = ".gif";
int maxImageSize = 10000;
SqlConnection conn = null;
SqlCommand cmd = null;
static void Main(string[] args)
{
LoadImages lg = new LoadImages();
Console.ReadKey();
}
void OpenConnection()
{
conn = new SqlConnection("Data Source=S013;Initial Catalog=test;Integrated Security=True");
conn.Open();
}
void CloseConnection()
{
conn.Close();
Console.WriteLine("Connection Closed!");
}
void CreateCommand()
{
cmd = new SqlCommand();
cmd.Connection = conn;
}
void ExecuteCommand()
{
int cmdResult;
cmd.CommandTextcmdText;
Console.WriteLine("Execute command");
Console.WriteLine(cmd.CommandText);
cmdResult = cmd.ExecuteNonQuery();
Console.WriteLine("ExecuteNonQuery return {0}",cmdResult);
}
void CreateImageTable()
{
ExecuteCommand(@"
create table imagetable
(
imagefile nvarchar(20),
imagedate varbinary(max)
)
");
}
void PrepareInsertImages()
{
cmd.CommandText = @"insert into imagetable values(@imagefile,@imagedata)";
}
}
}