Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
id_drug.Text = Request.QueryString("id_drug1")
Dim StrConn As String
Dim Sql As String
StrConn = WebConfigurationManager.ConnectionStrings("conn").ConnectionString
Dim Conn As New SqlConnection(StrConn)
Conn.Open()
Dim a As String
Sql = "SELECT * FROM drug WHERE id_drug = '" & id_drug.Text & "' "
Dim sqlCom As New SqlCommand(Sql, Conn)
Dim dr As SqlDataReader = SqlCom.ExecuteReader
While dr.Read
Me.name_drug.Text = dr.Item("name_drug")
Me.cost_buy.Text = dr.Item("cost_buy")
Me.cost_sale.Text = dr.Item("cost_sale")
Me.quantity.Text = dr.Item("quantity")
Me.lot_num.Text = dr.Item("lot_num")
Me.EXP.Text = dr.Item("EXP")
Me.Mfg.Text = dr.Item("Mfg")
End While
dr.Close()
Conn.Close()
End Sub
Protected Sub add_drug_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles add_drug.Click
Dim StrConn As String
StrConn = WebConfigurationManager.ConnectionStrings("Conn").ConnectionString
Dim Conn As New SqlConnection(StrConn)
Conn.Open()
Dim StrCmd As String
StrCmd = ("UPDATE drug SET id_mode = '" & mode.Text & "',name_drug = '" & aaa.Text & "',cost_buy = '" & cost_buy.Text & "',cost_sale = '" & cost_sale.Text & "',quantity = '" & quantity.Text & "',lot_num = '" & lot_num.Text & "',EXP = '" & EXP.Text & "',Mfg = '" & Mfg.Text & "' WHERE id_drug = '" & id_drug.Text & "' ")
Dim SqlCmd As New SqlCommand(StrCmd, Conn)
Response.Redirect("detail.aspx")
SqlCmd.ExecuteNonQuery()
Conn.Close()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load IF NOT Page.IsPostBack() Then
id_drug.Text = Request.QueryString("id_drug1")
Dim StrConn As String
Dim Sql As String
StrConn = WebConfigurationManager.ConnectionStrings("conn").ConnectionString
Dim Conn As New SqlConnection(StrConn)
Conn.Open()
Dim a As String
Sql = "SELECT * FROM drug WHERE id_drug = '" & id_drug.Text & "' "
Dim sqlCom As New SqlCommand(Sql, Conn)
Dim dr As SqlDataReader = SqlCom.ExecuteReader
While dr.Read
Me.name_drug.Text = dr.Item("name_drug")
Me.cost_buy.Text = dr.Item("cost_buy")
Me.cost_sale.Text = dr.Item("cost_sale")
Me.quantity.Text = dr.Item("quantity")
Me.lot_num.Text = dr.Item("lot_num")
Me.EXP.Text = dr.Item("EXP")
Me.Mfg.Text = dr.Item("Mfg")
End While
dr.Close()
Conn.Close() End IF
End Sub