تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تعديل كود لو سمحتو
#1
كود :
  Private Sub txtlabel_KeyDown(sender As Object, e As KeyEventArgs) Handles txtlabel.KeyDown
        Try
            If e.KeyCode = Keys.Enter Then
                'get product infos
                cmd = New OleDb.OleDbCommand("select id, PRICE from tab_pro where label = " & txtlabel.Text, con)
                con.Open()
                Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader
                dr.Read()
                If dr.HasRows Then
                    txtid.Text = dr(0)
                    txtprice.Text = dr(1)
                    txtqty.Focus()
                Else
                    MsgBox("تحقق من المنتج", MsgBoxStyle.Exclamation, "تنبيه")
                    clear()
                End If
                dr.Close()
            End If
        Catch ex As Exception
            Exit Sub
        Finally
            con.Close()
        End Try
    End Sub
الرد }}}
تم الشكر بواسطة:
#2
ما التعديل المطلوب؟
الرد }}}
تم الشكر بواسطة:
#3
تفضل التعديل
PHP كود :
Private Sub txtlabel_KeyDown(sender As ObjectAs KeyEventArgsHandles txtlabel.KeyDown
    
If e.KeyCode Keys.Enter Then
        
Try

            
'get product infos
            Dim da As New OleDb.OleDbDataAdapter("SELECT [id], [PRICE] FROM [tab_pro] WHERE [label] = @lab", con)
            da.SelectCommand.Parameters.AddWithValue("@lab", txtlabel.Text)

            Dim dt As New DataTable
            If da.Fill(dt) > 0 Then
                Dim r As DataRow = dt.Rows(0)
                txtid.Text = r("id")
                txtprice.Text = r("PRICE")
                txtqty.Select()

            Else
                MsgBox("تحقق من المنتج", MsgBoxStyle.Exclamation, "تنبيه")
                clear()

            End If

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End If
End Sub 
الرد }}}
تم الشكر بواسطة: نبيل كونكت , نبيل كونكت


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
Information [VB.NET] اضافة و تعديل و حدف و تنقل بين سجلات و بحث عادي و متقدم و عمليات اخرى sql aliday03 6 4,474 24-11-16, 06:04 PM
آخر رد: م.أسامة القرشي

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


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