PDA

View Full Version : مشکل در درج رکورد



programerinfonet
پنج شنبه 16 آذر 1391, 11:10 صبح
سلام دوستان من این کدو می نویسم برای insert این خطا ر میده

SqlCommand my_cmd = new SqlCommand("INSERT into finance(shakhs,datereg,type,mablaghd,discription,b ank,tarikh,number) values('" + ashkhascod + "','" + mtxtdate.Text + "','" + radiotext + "','" + txtmablagh.Text + "','" + txtdiscription.Text + "','" + comboBox1.Text + "','" + textBox1.Text + "','" + txtProNet1.Text + "')", my_con);
SqlCommand my_cmd2 = new SqlCommand("INSERT into cheq(datein,bank,mablagh,dateout,number,shakhs,sta te,disc) values('" + mtxtdate.Text + "','" + comboBox1.Text + "','" + txtmablagh.Text + "','" + textBox1.Text + "','" + txtProNet1.Text + "','" + ashkhascod + "','دریافتی','" + txtdiscription.Text + "')", my_con);
my_cmd.ExecuteReader();
my_cmd2.ExecuteReader();

96151

لطفأ کمک کنید
ممنون

programerinfonet
پنج شنبه 16 آذر 1391, 12:59 عصر
یعنی کسی نبود کمک کنه ؟؟؟؟؟

zarrinnegar
پنج شنبه 16 آذر 1391, 13:03 عصر
خطا نشون میده که datereader رو 2 بار فراخوانی میکنی که اولی بسته نشده دوباره باز میکنی
یعنی دستوراتت رو 2 تکه کن ولی کامل , یعنی از کانکت شدن به دیتابیس تا بستن اون

programerinfonet
پنج شنبه 16 آذر 1391, 15:06 عصر
آخه از دو دستور بالا اولی اجرا میشه و دومی نه
یعنی پیغام خطا رو میده اما اینسرت اولی کار می کنه و دومی خطا میده