Dim str As String = ""
da = New SqlDataAdapter(sql, cn)
dtsearch = New DataTable
da.Fill(dtsearch)
If dtsearch.Rows.Count > 0 Then
If TxtNum.Text = "" Then
MessageBox.Show("กรุณารับุจำนวน", "การแจ้งเตือน", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
str = dtsearch.Rows(0).Item("price")
Txtcost.Text = str.Trim
Txtcost.Text = Math.Round(Val(Txtcost.Text), 2)
Txtvalue.Text = str * Convert.ToInt32(TxtNum.Text)
Txtvalue.Text = Math.Round(Val(Txtvalue.Text), 2)
Exit Sub
End If