منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : مشكله فى عرض تقرير الفاتورة
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
بسم الله الرحمن الرحيم

السلام عليكم ياشباب

رسالة الخطأ دى ظهرتلى


وده الكود الى فيه الخطأ

كود :
  //=================================================================================
       private void tooL_SAVE_Click(object sender, EventArgs e)
       {
           

               string typ_
                   = "BILL_1.TYP=100";
             

               if (check_PURSHASE.Checked == true)
               {
                   typ_ = typ_ + " " + "or BILL_1.TYP=11";
               }


               if (check_RETURN_PURSHASE.Checked == true)
               {
                   typ_ = typ_ + " " + "or BILL_1.TYP=12";
               }

               if (check_SALE.Checked == true)
               {
                   typ_ = typ_ + " " + "or BILL_1.TYP=13";
               }

               if (check_RETURNE_SALE.Checked == true)
               {
                   typ_ = typ_ + " " + "or BILL_1.TYP=14";
               }

               if (check_POS1.Checked == true)
               {
                   typ_ = typ_ + " " + "or BILL_1.typ=15";
               }

               if (check_BEGIN_ITEME.Checked == true)
               {
                   typ_ = typ_ + " " + "or BILL_1.typ=16";
               }




               if (txt_.Text == "0")
               {
                   if (TXT_NAME_ACCOUNT.Text == "")
                   {

                       MessageBox.Show("يجب ادخال اسم الحساب", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                       return;
                   }
               }

               //REP.REP_ACCOUNT.Frm_print_allbill allday = new REP.REP_ACCOUNT.Frm_rep_allday();
               REP.REP_ITEME.Frm_print_allbill allday
                   = new REP.REP_ITEME.Frm_print_allbill();


               DateTime d1
                   = Convert.ToDateTime(DTP1.Value.ToShortDateString());
               DateTime d2
                   = Convert.ToDateTime(DTP2.Value.ToShortDateString());


               string str;

               DataTable dt = new DataTable();
               dt.Clear();
               if (TXT_NAME_ACCOUNT.Text == "")
               {
                   str = "SELECT   dbo.BILL_1.ID_BILL AS الرقم , dbo.BILL_1.DATE_BILL AS التاريخ, dbo.name_type.name AS النوع, dbo.currency.name_currency AS العملة, dbo.account.Name AS [الطرف الثاني], dbo.BILL_1.NOTE AS ملاحظات,         dbo.BILL_1.TSDID AS التسديد, account_1.Name AS الصندوق, dbo.BILL_1.VAL_CASH AS [مبلغ الدفعة], dbo.BILL_1.HSM AS الحسم, dbo.BILL_1.TOTAL AS الاجمالي  FROM         dbo.BILL_1 INNER JOIN             dbo.name_type ON dbo.BILL_1.TYP = dbo.name_type.id INNER JOIN             dbo.account ON dbo.BILL_1.CUSTOMER = dbo.account.id INNER JOIN               dbo.account AS account_1 ON dbo.BILL_1.CASH = account_1.id INNER JOIN         dbo.currency ON dbo.BILL_1.CURRENCY_BILL = dbo.currency.id_currency  WHERE     (dbo.BILL_1.TRHILE = 1) and  (" + typ_ + ") and   (BILL_1.DATE_BILL BETWEEN  ('" + d1.Month + "/" + d1.Day + "/" + d1.Year + "')  AND ('" + d2.Month + "/" + d2.Day + "/" + d2.Year + "')) order by BILL_1.ID";

                   allday.TXT_NAME_ACCOUNT.Visible = false;
                   allday.LBL_ACCOUNT.Visible = false;

               }
               else
               {
                   str = "SELECT     dbo.BILL_1.ID_BILL AS الرقم ,dbo.BILL_1.DATE_BILL AS التاريخ, dbo.name_type.name AS النوع, dbo.currency.name_currency AS العملة, dbo.account.Name AS [الطرف الثاني], dbo.BILL_1.NOTE AS ملاحظات,         dbo.BILL_1.TSDID AS التسدسد, account_1.Name AS الصندةق, dbo.BILL_1.VAL_CASH AS [مبلغ دفعة], dbo.BILL_1.HSM AS الحسم, dbo.BILL_1.TOTAL AS الاجمالي  FROM         dbo.BILL_1 INNER JOIN             dbo.name_type ON dbo.BILL_1.TYP = dbo.name_type.id INNER JOIN             dbo.account ON dbo.BILL_1.CUSTOMER = dbo.account.id INNER JOIN               dbo.account AS account_1 ON dbo.BILL_1.CASH = account_1.id INNER JOIN         dbo.currency ON dbo.BILL_1.CURRENCY_BILL = dbo.currency.id_currency  WHERE     (dbo.BILL_1.TRHILE = 1)  and  (" + typ_ + ") and (BILL_1.CUSTOMER =" + Convert.ToInt32(TXT_ID_ACCOUNT.Text) + ") AND  (BILL_1.DATE_BILL BETWEEN  ('" + d1.Month + "/" + d1.Day + "/" + d1.Year + "')  AND ('" + d2.Month + "/" + d2.Day + "/" + d2.Year + "')) order by BILL_1.ID";


               }


               //textBox1.Text = str;
               
               SqlDataAdapter adp = new SqlDataAdapter(str, con);
               adp.Fill(dt);
               if (dt.Rows.Count == 0)
               {

                   MessageBox.Show("لايوجد حركة ضمن هذه الفترة", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information);
                   return;
               }
               allday.DGV.DataSource = dt;
وعليكم السلام
هل قمت بعمل استنساخ للمتغير con وإضافة نص الاتصال ؟
مش فاهم اخى الكريم استنساخ ايه
(30-05-17, 02:35 AM)احمد عبد الحكيم كتب : [ -> ]مش فاهم اخى الكريم استنساخ ايه

PHP كود :
SqlConnection con = new SqlConnection ("my connectio string"); 
انت لم تضع الكود الخاص بالاتصال SqlConnection con

تأكد من تهيئة ConnectionString للمتغير con الخاص بالاتصال بقاعدة البيانات بحيث يحتوي على النص الكامل للإتصال بقاعدة البيانات بدون أخطاء وسيكون مشابه لماذا في هذا الموضوع https://www.connectionstrings.com/sql-server
كود الاتصال موجود لاكن موجود فى ملف txt
من الواضح أخي الكريم أن هناك خلل إما إملائي أو في استنساخ جملة الإتصال، نرجو منك أخي الكريم رفع صورة عن جملة الإتصال في ملف txt وأيضا صورة عن الجملة في صفحة الأكواد في المشروع.
اخ احمد فين ملف txt وكيف طريقتك بقراءته ووضعه في الاتصال con؟