반응형
save
- string queryStmt = "INSERT INTO dbo.YourTable(Content) VALUES(@Content)";
- using(SqlConnection _con = new SqlConnection(--your-connection-string-here--))
- using(SqlCommand _cmd = new SqlCommand(query, _con))
- {
- SqlParameter param = _cmd.Parameters.Add("@Content", SqlDbType.VarBinary);
- param.Value = YourByteArrayVariableHere;
- _con.Open();
- _cmd.ExecuteNonQuery();
- _con.Close();
- }
load
- SqlCommand test_scmd = new SqlCommand("SELECT dbo.YourTable FROM Content");
- test_scmd.Connection = SQL_Connection;
- SqlDataReader test_sdr = test_scmd.ExecuteReader();
- if (test_sdr.Read())
- {
- byte[] test_object = test_sdr["Content"] as byte[];
- }
- test_sdr.Close();
반응형
'Programming > C#' 카테고리의 다른 글
C# byte array to Array.ConvertAll: (0) | 2013.10.03 |
---|---|
C# Convert hex string to byte array (0) | 2013.09.26 |
C# SqlDataReade (0) | 2013.09.25 |
C# write text file (0) | 2013.09.25 |
c# 16진수 -> 10진수 (0) | 2013.09.24 |