Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Medicine Information:

using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class VHMS_Masters_FrmMedicineM : System.Web.UI.Page


{
public SqlConnection conn;
public SqlCommand cmd;
string strsql;

protected void Page_Load(object sender, EventArgs e)


{
txtmname.Attributes.Add("onkeypress", "javascript:return
checkchar(event);");
txtup.Attributes.Add("onkeypress", "javascript:return
checknum(event);");
txtus.Attributes.Add("onkeypress", "javascript:return
checknum(event);");
txtreorder.Attributes.Add("onkeypress", "javascript:return
checknum(event);");
conn = new
SqlConnection(System.Configuration.ConfigurationManager.AppSettings["Coralconn
"]);
if (!IsPostBack)
{

}
}
protected void Button1_Click(object sender, EventArgs e)
{
conn = new
SqlConnection(System.Configuration.ConfigurationManager.AppSettings["Coralconn
"]);
strsql = "insert into
Medicines_Maintenance(MedicineID,MedicineName,DosageForm,UnitPrice,UnitsInStoc
k,ReorderLevel,AdditionalNotes) values('" + txtmid.Text + "','" +
txtmname.Text + "','" + ddldosage.SelectedItem.Text + "','" + txtup.Text +
"','" + txtus.Text + "','" + txtreorder.Text + "','" + txtadnot.Text + "')";
SqlCommand cmd = new SqlCommand(strsql, conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
txtadnot.Text = "";
txtmid.Text = "";
txtmname.Text = "";
txtreorder.Text = "";
txtup.Text = "";
txtus.Text = "";

}
}

You might also like