往Oracle数据库中导入图片时出现的ORA-01036:非法的变量名/编号
private void 添加图片_Click(object sender, EventArgs e)
{
openFileDialog1.InitialDirectory = Application.ExecutablePath;
openFileDialog1.Filter = "JPG Files(*.jpg)|*.jpg|All Files(*.*)|*.*";
openFileDialog1.FileName = "";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string strFileName = System.IO.Path.GetFileName(openFileDialog1.FileName);
theFile = openFileDialog1.FileName;
try
{
byte[] fileData = getBytes(theFile);
string ConnString = "Data Source=oracle_edubj;Persist Security Info=True;User ID=edubj;Password=edubj; Unicode=True";
string sql = "insert into dubj_info(学校图片,图片名称) values(@学校图片,'" + strFileName + "')";
int icount = listBox1.Items.Count;
listBox1.Items.Insert(icount, strFileName);
OracleConnection Conn = new OracleConnection(ConnString);
OracleCommand cmd = new OracleCommand(sql, Conn);
cmd.Parameters.Add("学校图片", OracleType.Blob);
cmd.Parameters["学校图片"].Value = fileData;
Conn.Open();
cmd.ExecuteNonQuery();
Conn.Close();
// this.pictureBox1.Image = convertByteToImg(getImageDataFromAcess());
listBox1.SelectedIndex = icount;
}
catch (Exception excep)
{
MessageBox.Show(excep.Message);
}
finally
{
}
}
}
public byte[] getBytes(string filePath)
{
System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite);
byte[] imgData = new byte[fs.Length];
fs.Read(imgData, 0, (int)fs.Length);
return imgData;
}
各位大侠给看看应该怎么改。