错误保存到数据库的方法 [英] Mistake on method to save to database
本文介绍了错误保存到数据库的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个方法,可以将图像保存到数据库中:
I have a method, which saves image to database:
public int AddPhoto(Photo photo)
{
int s;
s = 0;
string PhotoIns;
FileStream fs = new FileStream("d:\\123.JPG", FileMode.Open, FileAccess.Read);
byte[] im = new byte[fs.Length];
fs.Read(im, 0, im.Length);
photo.id = getId();
photo.Image = im;
PhotoIns = "insert into person_picture(persp_id,persp_comment,persp_picture) values('"+@photo.id+"','"+@photo.Comment+"','"+@photo.Image+"')";
OracleParameterCollection pa = new OracleParameterCollection();
OracleConnection oracon = new OracleConnection(con);
oracon.Open();
OracleCommand InsPhoto = new OracleCommand(PhotoIns, oracon);
OracleParameter par = new OracleParameter();
par.Direction = ParameterDirection.Input;
InsPhoto.Parameters.Add("@photo.id", OracleType.Number).Value = photo.id;
InsPhoto.Parameters.Add("@photo.Comment", OracleType.VarChar).Value = photo.Comment;
InsPhoto.Parameters.Add("@photo.Image", OracleType.Blob).Value = photo.Image;
OracleDataReader oradr = InsPhoto.ExecuteReader();
oradr.Read();
oracon.Dispose();
return s;
}
当我使用我的方法时,会出现类似"ORA-01036:非法变量名称/数字"的错误
我不明白为什么这个错误会导致...
When I use my method allows a mistake like "ORA-01036: illegal variable name/number"
I can''t understand why this mistake allows...
推荐答案
这些链接可能对您有帮助
http://www.outsystems. com/NetworkForums/ViewTopic.aspx?TopicId = 8333& Topic = ORA-01036%3A-illegal-variable-name%2Fnumber [ http://www.dba-oracle.com/t_ora_01036_exp_illegal_name_number.htm [ http://forums.asp.net/t/975011.aspx/1 [ ^ ]
These links may help you
http://www.outsystems.com/NetworkForums/ViewTopic.aspx?TopicId=8333&Topic=ORA-01036%3A-illegal-variable-name%2Fnumber[^]
http://www.dba-oracle.com/t_ora_01036_exp_illegal_name_number.htm[^]
http://forums.asp.net/t/975011.aspx/1[^]
这篇关于错误保存到数据库的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文