sql server 에서 binary(고정) 또는 varbinary(가변) 형식으로 컬럼 타입을 맟춰 주시면 될듯 합니다.
입력 방식은
byte[] bin = new byte[]{0x01, 0x02, 0x03, ..... 0xff};
SqlConnection Conn = new SqlConnection("Data Source=localhost;....");
SqlCommand Comm = new SqlCommand("INSERT INTO test Values(@BinData)", Conn);
Comm.Parameters.Add(@BinData", SqlDbType.VarBinary, bin.Length).Value = bin;
Conn.Open();
Comm.ExecuteNonQuery();
DB
serial int not null,
userid char(25) not null,
Template1 VarBinary(1500),
Template2 Binary null,
PRIMARY KEY CLUSTERED
(
[userid] DESC
)ON [PRIMARY]
);
// Assuming "conn" is an open SqlConnection
using(SqlCommand cmd = new SqlCommand("INSERT INTO mssqltable(varbinarycolumn) VALUES (@binaryValue)", conn))
{
// Replace 8000, below, with the correct size of the field
cmd.Parameters.Add("@binaryValue", SqlDbType.VarBinary, 8000).Value = arraytoinsert;
cmd.ExecuteNonQuery();
}
댓글 없음:
댓글 쓰기