PDA

View Full Version : سوال: مشکل در کوئری insert



پیام حیاتی
شنبه 07 شهریور 1394, 19:11 عصر
سلام
این کدهای من :


string patch1 = "";
if (FileUpload2.HasFile && FileUpload2.PostedFile.ContentLength < 512000)
{
string filename1 = FileUpload2.FileName;
FileUpload2.PostedFile.SaveAs(Server.MapPath("~\\Order_Graphic\\" + filename1));
patch1 = "~\\Order_Graphic\\" + filename1;
}


con.Open();
string Query = "insert into Order_Graphic (g_fullname , g_email , g_phone , g_title , g_pic , g_descrip) values ('" + txt_name.Text + "' , '" + txt_email.Text + "' , '" + txt_phone.Text + "' , '" + drop.SelectedItem + "' , '" + patch1 + "' , '" + txt_descrip.Text + "') ";
SqlCommand com = new SqlCommand(Query, con);
com.ExecuteNonQuery();
con.Close();


خطا :

An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code

Additional information: String or binary data would be truncated.


134723

تشکر.

malloc
شنبه 07 شهریور 1394, 19:54 عصر
این
drop.SelectedItem
چی برمیگرونه ؟؟؟

فکر کنم یه value هم آخرش باید بزاری

پیام حیاتی
شنبه 07 شهریور 1394, 20:07 عصر
تشکر malloc (http://barnamenevis.org/member.php?164351-malloc) عزیز
یکی این بود یکی هم تعداد کاراکترها رو کم گذاشته بودم در جدول برای فیلد توضیحات.