1个回答
展开全部
存进去:
try
{
OracleConnection conn = new OracleConnection(
"Data Source=localhost;" +
"Persist Security Info=True;" +
"User ID=C07;Password=C07;Unicode=True");
conn.Open();
OracleCommand cmd = new OracleCommand(
"INSERT INTO GAMBAR VALUES(:blobtodb)",
conn);
cmd.CommandType = CommandType.Text;
OracleParameter param = cmd.Parameters.Add("blobtodb",
OracleType.Blob);
param.Direction = ParameterDirection.Input;
param.Value = imgViewer.ImageBinaryData;
cmd.ExecuteNonQuery();
conn.Close();
MessageBox.Show("Image saved");
}
catch (Exception ex)
{
MessageBox.Show("failed to save (" + ex.Message + ")");
}
读出来:
OracleConnection conn = new OracleConnection(
"Data Source=localhost;" +
"Persist Security Info=True;" +
"User ID=C07;Password=C07;Unicode=True");
conn.Open();
OracleDataAdapter ad = new OracleDataAdapter(
"SELECT ROWNUM, GAMBAR_BIN FROM GAMBAR",
conn);
DataTable tb = new DataTable();
ad.Fill(tb);
comboBox1.DataContext = tb;
conn.Close();
如果你是用wpf开发可以参考:
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询