تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] ممكن المساعدة في اجراء بحث كومبوبكس وتيكست
#11
لو ترفق مثال ليتم التعديل عليه.
[صورة مرفقة: images?q=tbn:ANd9GcT72OLJW7D1E5QW-HUeWeJ...TGoNeg2jnQ]
الرد }}}
تم الشكر بواسطة:
#12
(15-07-24, 06:28 PM)تركي الحلواني كتب : لو ترفق مثال ليتم التعديل عليه.

سوف يتم تجهيز وارفاق ملف العمل

تم ارسال المشروع على الخاص
الرد }}}
تم الشكر بواسطة:
#13
PHP كود :
Sub LoadRecords()
    Dim i As Integer = 0
    Dim total As Double 
= 0
    DataGridView1
.Rows.Clear()

    cn.Open()

        Dim query As String = "SELECT * FROM tblProduct AS p " &
                          "INNER JOIN tblGeneric AS g ON p.ProductGeneric = GenericID " &
                          "INNER JOIN tblBrand AS b ON p.ProductBrand = BrandID " &
                          "INNER JOIN tblFromulation AS f ON p.ProductFromulation = FromulationID " &
                          "INNER JOIN tblClassification AS c ON p.ProductClassification = ClassificationID " &
                          "INNER JOIN tblType AS t ON p.ProductType = TypeID " &
                          "WHERE ProductQuantity > 0 AND " & cboFilter.Text & " LIKE @SearchText"

    dim cm as New SqlCommand(query, cn)
    cm.Parameters.AddWithValue("@SearchText", "%" & txtSearch.Text & "%")

    dim dr as sqldatareader = cm.ExecuteReader()

         While dr.Read()
        i += 1
        total 
+= CInt(dr.Item("ProductQuantity").ToString())
        DataGridView1.Rows.Add(i, 
                               dr
.Item("ProductID").ToString(), 
                               dr
.Item("ProductBarcode").ToString(), 
                               dr
.Item("GenericName").ToString(), 
                               dr
.Item("BrandName").ToString(), 
                               dr
.Item("FromulationName").ToString(), 
                               dr
.Item("ClassificationName").ToString(), 
                               dr
.Item("TypeName").ToString(), 
                               dr
.Item("ProductQuantity").ToString(), 
                               dr
.Item("ProductBuyPrice").ToString(), 
                               dr
.Item("ProductSalePrice").ToString(), 
                               Format
(CDate(dr.Item("ProductDate").ToString()), "yyyy/MM"), 
                               dr
.Item("ProductReorder").ToString())
    End While

       dr
.Close()
    cm = Nothing
        cn
.Close()

      lblCount.Text = "عدد المنتجات: " & Format(CLng(DataGridView1.Rows.Count), "#,##0") & Space(10) & " كمية المنتجات: " & Format(total, "#,##0")
End Sub  
الرد }}}
تم الشكر بواسطة:
#14
(16-07-24, 03:23 AM)Zuhare كتب :
PHP كود :
Sub LoadRecords()
    Dim i As Integer = 0
    Dim total As Double 
= 0
    DataGridView1
.Rows.Clear()

    cn.Open()

        Dim query As String = "SELECT * FROM tblProduct AS p " &
                          "INNER JOIN tblGeneric AS g ON p.ProductGeneric = GenericID " &
                          "INNER JOIN tblBrand AS b ON p.ProductBrand = BrandID " &
                          "INNER JOIN tblFromulation AS f ON p.ProductFromulation = FromulationID " &
                          "INNER JOIN tblClassification AS c ON p.ProductClassification = ClassificationID " &
                          "INNER JOIN tblType AS t ON p.ProductType = TypeID " &
                          "WHERE ProductQuantity > 0 AND " & cboFilter.Text & " LIKE @SearchText"

    dim cm as New SqlCommand(query, cn)
    cm.Parameters.AddWithValue("@SearchText", "%" & txtSearch.Text & "%")

    dim dr as sqldatareader = cm.ExecuteReader()

         While dr.Read()
        i += 1
        total 
+= CInt(dr.Item("ProductQuantity").ToString())
        DataGridView1.Rows.Add(i, 
                               dr
.Item("ProductID").ToString(), 
                               dr
.Item("ProductBarcode").ToString(), 
                               dr
.Item("GenericName").ToString(), 
                               dr
.Item("BrandName").ToString(), 
                               dr
.Item("FromulationName").ToString(), 
                               dr
.Item("ClassificationName").ToString(), 
                               dr
.Item("TypeName").ToString(), 
                               dr
.Item("ProductQuantity").ToString(), 
                               dr
.Item("ProductBuyPrice").ToString(), 
                               dr
.Item("ProductSalePrice").ToString(), 
                               Format
(CDate(dr.Item("ProductDate").ToString()), "yyyy/MM"), 
                               dr
.Item("ProductReorder").ToString())
    End While

       dr
.Close()
    cm = Nothing
        cn
.Close()

      lblCount.Text = "عدد المنتجات: " & Format(CLng(DataGridView1.Rows.Count), "#,##0") & Space(10) & " كمية المنتجات: " & Format(total, "#,##0")
End Sub  

شكر جزيلا ولكن نفس الخطأ في Like
الرد }}}
تم الشكر بواسطة:
#15
PHP كود :
Sub LoadRecords()
    Dim i As Integer = 0
    Dim total As Double 
= 0
    DataGridView1
.Rows.Clear()

    cn.Open()

        Dim query As String = "SELECT * FROM tblProduct AS p " &
                          "INNER JOIN tblGeneric AS g ON p.ProductGeneric = GenericID " &
                          "INNER JOIN tblBrand AS b ON p.ProductBrand = BrandID " &
                          "INNER JOIN tblFromulation AS f ON p.ProductFromulation = FromulationID " &
                          "INNER JOIN tblClassification AS c ON p.ProductClassification = ClassificationID " &
                          "INNER JOIN tblType AS t ON p.ProductType = TypeID " &
                          "WHERE ProductQuantity > 0 AND " & cboFilter.Text & " LIKE '%'+@SearchText+'%'"

    dim cm as New SqlCommand(query, cn)
    cm.Parameters.AddWithValue("@SearchText",  txtSearch.Text )

    dim dr as sqldatareader = cm.ExecuteReader()

         While dr.Read()
        i += 1
        total 
+= CInt(dr.Item("ProductQuantity").ToString())
        DataGridView1.Rows.Add(i, 
                               dr
.Item("ProductID").ToString(), 
                               dr
.Item("ProductBarcode").ToString(), 
                               dr
.Item("GenericName").ToString(), 
                               dr
.Item("BrandName").ToString(), 
                               dr
.Item("FromulationName").ToString(), 
                               dr
.Item("ClassificationName").ToString(), 
                               dr
.Item("TypeName").ToString(), 
                               dr
.Item("ProductQuantity").ToString(), 
                               dr
.Item("ProductBuyPrice").ToString(), 
                               dr
.Item("ProductSalePrice").ToString(), 
                               Format
(CDate(dr.Item("ProductDate").ToString()), "yyyy/MM"), 
                               dr
.Item("ProductReorder").ToString())
    End While

       dr
.Close()
    cm = Nothing
        cn
.Close()

      lblCount.Text = "عدد المنتجات: " & Format(CLng(DataGridView1.Rows.Count), "#,##0") & Space(10) & " كمية المنتجات: " & Format(total, "#,##0")
End Sub  
الرد }}}
تم الشكر بواسطة:
#16
(17-07-24, 07:39 AM)Zuhare كتب :
PHP كود :
Sub LoadRecords()
    Dim i As Integer = 0
    Dim total As Double 
= 0
    DataGridView1
.Rows.Clear()

    cn.Open()

        Dim query As String = "SELECT * FROM tblProduct AS p " &
                          "INNER JOIN tblGeneric AS g ON p.ProductGeneric = GenericID " &
                          "INNER JOIN tblBrand AS b ON p.ProductBrand = BrandID " &
                          "INNER JOIN tblFromulation AS f ON p.ProductFromulation = FromulationID " &
                          "INNER JOIN tblClassification AS c ON p.ProductClassification = ClassificationID " &
                          "INNER JOIN tblType AS t ON p.ProductType = TypeID " &
                          "WHERE ProductQuantity > 0 AND " & cboFilter.Text & " LIKE '%'+@SearchText+'%'"

    dim cm as New SqlCommand(query, cn)
    cm.Parameters.AddWithValue("@SearchText",  txtSearch.Text )

    dim dr as sqldatareader = cm.ExecuteReader()

         While dr.Read()
        i += 1
        total 
+= CInt(dr.Item("ProductQuantity").ToString())
        DataGridView1.Rows.Add(i, 
                               dr
.Item("ProductID").ToString(), 
                               dr
.Item("ProductBarcode").ToString(), 
                               dr
.Item("GenericName").ToString(), 
                               dr
.Item("BrandName").ToString(), 
                               dr
.Item("FromulationName").ToString(), 
                               dr
.Item("ClassificationName").ToString(), 
                               dr
.Item("TypeName").ToString(), 
                               dr
.Item("ProductQuantity").ToString(), 
                               dr
.Item("ProductBuyPrice").ToString(), 
                               dr
.Item("ProductSalePrice").ToString(), 
                               Format
(CDate(dr.Item("ProductDate").ToString()), "yyyy/MM"), 
                               dr
.Item("ProductReorder").ToString())
    End While

       dr
.Close()
    cm = Nothing
        cn
.Close()

      lblCount.Text = "عدد المنتجات: " & Format(CLng(DataGridView1.Rows.Count), "#,##0") & Space(10) & " كمية المنتجات: " & Format(total, "#,##0")
End Sub  
 اعتذر اتعبتكم معي جزيتم خيرا من الله
الرد }}}
تم الشكر بواسطة:
#17
المشكله في محتوى cboFilter.Text فماذا يوجد بيها؟

المفروض يكون في cboFilter.Text اسم عمود صحيح بدون مسافات
الرد }}}
تم الشكر بواسطة:
#18
(17-07-24, 10:11 AM)Zuhare كتب : المشكله في محتوى cboFilter.Text فماذا يوجد بيها؟

المفروض يكون في cboFilter.Text اسم عمود صحيح بدون مسافات
cbofilter كومبوبوكس يحتوي على طريقة البحث


الرد }}}
تم الشكر بواسطة:
#19
لازم يكون اسم العمود موجود في مكان cboFilter.Text
PHP كود :
Sub LoadRecords()

dim filter as string=""

if cboFilter.Text="بالباركود" then
  filter
="tblProduct.barcode"
elseif cboFilter.Text="بالمنتج" then
  filter
="tblProduct.product"
elseif cboFilter.Text="بالشركة" then
  filter
="tblBrand.BrandID"
elseif cboFilter.Text="بالدولة" then
  filter
="tblProduct.country"
elseif cboFilter.Text="بالصنف" then
  filter
="tblClassification.ClassificationID"
elseif cboFilter.Text="بالنوع" then
  filter
="tblType.TypeID"
elseif cboFilter.Text="بالعدد" then
  filter
="tblProduct.dddddddd"
elseif cboFilter.Text="بسعر الشراء" then
  filter
="tblProduct.ssssssss"
elseif cboFilter.Text="بسعر البيع" then
  filter
="tblProduct.bbbbbb"
elseif cboFilter.Text="بالنفاذ" then
  filter
="tblProduct.nnnnnnn"
else
 
 exit sub
end 
if

    Dim i As Integer = 0
    Dim total As Double 
= 0
    DataGridView1
.Rows.Clear()

    cn.Open()

        Dim query As String = "SELECT * FROM tblProduct AS p " &
                          "INNER JOIN tblGeneric AS g ON p.ProductGeneric = GenericID " &
                          "INNER JOIN tblBrand AS b ON p.ProductBrand = BrandID " &
                          "INNER JOIN tblFromulation AS f ON p.ProductFromulation = FromulationID " &
                          "INNER JOIN tblClassification AS c ON p.ProductClassification = ClassificationID " &
                          "INNER JOIN tblType AS t ON p.ProductType = TypeID " &
                          "WHERE ProductQuantity > 0 AND " & filter & " LIKE '%'+@SearchText+'%'"

    dim cm as New SqlCommand(query, cn)
    cm.Parameters.AddWithValue("@SearchText",  txtSearch.Text )

    dim dr as sqldatareader = cm.ExecuteReader()

         While dr.Read()
        i += 1
        total 
+= CInt(dr.Item("ProductQuantity").ToString())
        DataGridView1.Rows.Add(i, 
                               dr
.Item("ProductID").ToString(), 
                               dr
.Item("ProductBarcode").ToString(), 
                               dr
.Item("GenericName").ToString(), 
                               dr
.Item("BrandName").ToString(), 
                               dr
.Item("FromulationName").ToString(), 
                               dr
.Item("ClassificationName").ToString(), 
                               dr
.Item("TypeName").ToString(), 
                               dr
.Item("ProductQuantity").ToString(), 
                               dr
.Item("ProductBuyPrice").ToString(), 
                               dr
.Item("ProductSalePrice").ToString(), 
                               Format
(CDate(dr.Item("ProductDate").ToString()), "yyyy/MM"), 
                               dr
.Item("ProductReorder").ToString())
    End While

       dr
.Close()
    cm = Nothing
        cn
.Close()

      lblCount.Text = "عدد المنتجات: " & Format(CLng(DataGridView1.Rows.Count), "#,##0") & Space(10) & " كمية المنتجات: " & Format(total, "#,##0")
End Sub  
وضعت متغير جديد اسمه filter وضعته بدل cboFilter.Tex في الاستعلام لكن راجع اسماء الاعمده ويكون يبدا باسم الجدول ثم نقطه ثم اسم العمود مثل tblBrand.ProductBrand
الرد }}}
تم الشكر بواسطة:
#20
كم اخبرك الاخ (Zuhare)
مع وجود بعض التعديل على الكود الخاص به
PHP كود :
Sub LoadRecords()

 
    Dim filter As String ""

 
    If cboFilter.Text "بالباركود" Then
         filter 
"p.ProductBarcode"
 
    ElseIf cboFilter.Text "بالمنتج" Then
         filter 
"g.GenericName"
 
    ElseIf cboFilter.Text "بالشركة" Then
         filter 
"b.BrandName"
 
    ElseIf cboFilter.Text "بالدولة" Then
         filter 
"f.FromulationName"
 
    ElseIf cboFilter.Text "بالصنف" Then
         filter 
"c.ClassificationName"
 
    ElseIf cboFilter.Text "بالنوع" Then
         filter 
"t.TypeName"
 
    ElseIf cboFilter.Text "بالعدد" Then
         filter 
"p.ProductQuantity"
 
    ElseIf cboFilter.Text "بسعر الشراء" Then
         filter 
"p.ProductBuyPrice"
 
    ElseIf cboFilter.Text "بسعر البيع" Then
         filter 
"p.ProductSalePrice"
 
    ElseIf cboFilter.Text "بالنفاذ" Then
         filter 
"p.ProductQuantity"
 
    Else
 
        Exit Sub
     End 
If

 
    Dim i As Integer 0
     Dim total 
As Double 0
     DataGridView1
.Rows.Clear()

 
    cn.Open()

 
    Dim query As String "SELECT * FROM tblProduct AS p " &
 
                      "INNER JOIN tblGeneric AS g ON p.ProductGeneric = GenericID " &
 
                      "INNER JOIN tblBrand AS b ON p.ProductBrand = BrandID " &
 
                      "INNER JOIN tblFromulation AS f ON p.ProductFromulation = FromulationID " &
 
                      "INNER JOIN tblClassification AS c ON p.ProductClassification = ClassificationID " &
 
                      "INNER JOIN tblType AS t ON p.ProductType = TypeID " &
 
                      "WHERE ProductQuantity > 0 AND " filter " LIKE '%'+@SearchText+'%'"

 
    Dim cm As New SqlCommand(querycn)
 
    cm.Parameters.AddWithValue("@SearchText"txtSearch.Text)

 
    Dim dr As SqlDataReader cm.ExecuteReader()

 
    While dr.Read()
 
        i += 1
         total 
+= CInt(dr.Item("ProductQuantity").ToString())
 
        DataGridView1.Rows.Add(i,
 
                           dr.Item("ProductID").ToString(),
 
                           dr.Item("ProductBarcode").ToString(),
 
                           dr.Item("GenericName").ToString(),
 
                           dr.Item("BrandName").ToString(),
 
                           dr.Item("FromulationName").ToString(),
 
                           dr.Item("ClassificationName").ToString(),
 
                           dr.Item("TypeName").ToString(),
 
                           dr.Item("ProductQuantity").ToString(),
 
                           dr.Item("ProductBuyPrice").ToString(),
 
                           dr.Item("ProductSalePrice").ToString(),
 
                           Format(CDate(dr.Item("ProductDate").ToString()), "yyyy/MM"),
 
                           dr.Item("ProductReorder").ToString())
 
    End While

 
    dr.Close()
 
    cm Nothing
     cn
.Close()

 
    lblCount.Text "عدد المنتجات: " Format(CLng(DataGridView1.Rows.Count), "#,##0") & Space(10) & " كمية المنتجات: " Format(total"#,##0")
 
End Sub 
[صورة مرفقة: images?q=tbn:ANd9GcT72OLJW7D1E5QW-HUeWeJ...TGoNeg2jnQ]
الرد }}}
تم الشكر بواسطة: Zuhare , Zuhare


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  ممكن ايضاح اكثر لـ continu for justforit 6 333 05-11-25, 12:10 AM
آخر رد: justforit
  [VB.NET] اذا ممكن مشروع ادارة مدرسة بدر إشتية 4 8,543 08-02-25, 02:05 AM
آخر رد: الورد2
  ارجو تعديل الكود جلب البيانات عن طريق اجراء مخزن - مرفق مثال new_programer 0 626 05-02-25, 01:51 AM
آخر رد: new_programer
  ممكن اعرف معنى مفهومي HLD ,LLD bassant 0 318 30-01-25, 02:07 PM
آخر رد: bassant
  [سؤال] اجراء المسح الضوئي وتصوير المستندات من خلال المستعرض ابوعبدالملك 3 380 24-01-25, 06:37 AM
آخر رد: ابوعبدالملك
  شيء غريب ممكن تفسير justforit 2 373 03-12-24, 11:44 PM
آخر رد: justforit
Exclamation [VB.NET] ممكن كود تشغيل ملف صوت MP3 الورد الصناعي 10 946 20-10-24, 03:08 PM
آخر رد: salamandal
Exclamation [VB.NET] ممكن عمل كود لحفظ المكتوب داخل اداة TextBox الورد الصناعي 9 816 17-10-24, 11:43 PM
آخر رد: salamandal
  ممكن طريقة عمل الصورة بشكل دائري بوحمد 3 498 14-10-24, 04:01 PM
آخر رد: بوحمد
  السلام عليكم ممكن كود بحث فى برنامج مصمم بالفيجوال بيسك وقاعدة بيانات اكسس خالد كامل1 1 466 08-10-24, 02:37 PM
آخر رد: salamandal

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


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم