تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[C#.NET] خطاء في switch و IF ممكن مساعدخ
#1
شباب انا استخدم switch ويوجد في داخلها if بس دائما يختار الحالة الاولى من switch  اما الحالات الباقيه ماينفذها ممكن مساعده في هذا ياشباب


كود :
process obj = new process();
           switch (process.search)
           {
               case "Engineer":
                   {
                       if (x == 0)
                       {


                           process.DdG = obj.getdata("select *from Engineer where idc_no=" + t,process.search);
                           process.DGcheck = true;
                           
                       }
                       else
                       {
                           process.DdG = obj.getdata("select *from Engineer where name='" + t+ "'", process.search);
                           process.DGcheck = true;
                           
                       }
                   }
                   break;
               case"Devices‎":
                      {
                       if (x == 0)
                       {
                           process.DdG = obj.getdata("select *from Devices where d_name='" + t + "'", process.search);
                           process.DGcheck = true;
                           break;
                       }
                   }
                   break;
               case "directions‎":
                   {
                       if (x == 0)
                       {
                           process.DdG = obj.getdata("select *from directions‎ where dir_no=" + t, process.search);
                           process.DGcheck = true;
                       }
                       else
                       {
                           process.DdG = obj.getdata("select *from directions‎ where dir_name='" + t + "'", process.search);
                           process.DGcheck = true;
                       }
                   }
                   break;
                        case "Ex_Devices‎":
                   {
                       if (x == 0)
                       {
                           process.DdG = obj.getdata("select *from Ex_Devices‎ where id=" + t, process.search);
                           process.DGcheck = true;
                       }
                       else
                       {
                           process.DdG = obj.getdata("select *from Ex_Devices‎ where exd_name='" + t + "'", process.search);
                           process.DGcheck = true;
                       }
                   }
                   break;
                        case "Sparparts‎":
                   {
                       if (x == 0)
                       {
                           process.DdG = obj.getdata("select *from Sparparts‎ where sp_no=" + t, process.search);
                           process.DGcheck = true;
                           lo();
                       }
                       else
                       {
                           process.DdG = obj.getdata("select *from Sparparts‎ where sp_name='" + t + "'", process.search);
                           process.DGcheck = true;
                       }
                   }
                   break;

           }
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
خطاء في switch و IF ممكن مساعدخ - بواسطة the viper - 22-01-16, 08:53 PM


التنقل السريع :


يقوم بقرائة الموضوع: