09-11-17, 08:56 PM
كود :
Private Sub TextBox1_Leave(sender As Object, e As EventArgs) Handles TextBox1.Leave
'فحص الاتصال بقاعدة البيانات
If SQL.conn.State = ConnectionState.Open Then
SQL.conn.Close()
End If
SQL.conn.Open()
Dim cmd As New SqlCommand()
cmd.Connection = SQL.conn
cmd.CommandText = "select * from price where partno =@partno"
cmd.Parameters.AddWithValue("@partno ", TextBox1.Text)
Dim dr As SqlDataReader = cmd.ExecuteReader
While dr.Read
desc.Text = dr.Item(2)
price.Text = dr.Item(3)
End While
dr.Close()
SQL.conn.Close()
If Not QTY.text = "" Then
total.text = QTY.text * TextBox4.Text
Else
total.text = TextBox4.Text
End If
End Sub