pesare
یک شنبه 09 تیر 1392, 15:44 عصر
سلام دوستان
من میخوام عکس رو با معماری سه لایه در اس کیو ال ذخیره کنم , برای این کار یه کلاس دارم که داخل اون متدی هست به نام SavePic ,قبل از متد دو تا متغیر دارم که اونها با مقادیر داخل فرم پر میشه و فرستاده میشه برای متد
متغیرداخل کلاس :
publicstring AF;
publicbyte[] arrPic;
متغیر از داخل فرم به این صورت پر میشن :
MemoryStream ms = newMemoryStream();
byte[] arrPic = null;
pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
arrPic = ms.GetBuffer();
ms.Close();
ApFroshi a = new ApFroshi();
a.arrPic = arrPic;
a.AF = txtID.Text;
a.SavePic();
حالا این مقادیری که پرشده فرستاده میشه به متد ذخیره :
publicvoid SavePic()
{
string sql = "Insert Into tblPic (Pic,AF_FK) Values ({0},{1})";
sql = string.Format(sql,this.arrPic,this.AF);
da.Connect();
da.DoCommand(sql);
da.Disconnect();
}
وقتی که اجرا میگیرم این خطا رو میده :
an object or column name is missing or empity . for select into statement verify each column has a name .for other statements ,look for empity elias names.Aliases define az " " or [] are not allowed.change the alias to valid name.incorrect syntax near ''.
این خطا برای چیه؟چطوری برطرف میشه؟
من میخوام عکس رو با معماری سه لایه در اس کیو ال ذخیره کنم , برای این کار یه کلاس دارم که داخل اون متدی هست به نام SavePic ,قبل از متد دو تا متغیر دارم که اونها با مقادیر داخل فرم پر میشه و فرستاده میشه برای متد
متغیرداخل کلاس :
publicstring AF;
publicbyte[] arrPic;
متغیر از داخل فرم به این صورت پر میشن :
MemoryStream ms = newMemoryStream();
byte[] arrPic = null;
pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
arrPic = ms.GetBuffer();
ms.Close();
ApFroshi a = new ApFroshi();
a.arrPic = arrPic;
a.AF = txtID.Text;
a.SavePic();
حالا این مقادیری که پرشده فرستاده میشه به متد ذخیره :
publicvoid SavePic()
{
string sql = "Insert Into tblPic (Pic,AF_FK) Values ({0},{1})";
sql = string.Format(sql,this.arrPic,this.AF);
da.Connect();
da.DoCommand(sql);
da.Disconnect();
}
وقتی که اجرا میگیرم این خطا رو میده :
an object or column name is missing or empity . for select into statement verify each column has a name .for other statements ,look for empity elias names.Aliases define az " " or [] are not allowed.change the alias to valid name.incorrect syntax near ''.
این خطا برای چیه؟چطوری برطرف میشه؟