⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yaopingrukuinsert2db.aspx

📁 医院进行药品进货,划价,派单等功能的系统
💻 ASPX
字号:
<%@ Page Language="C#" debug="true"%> 
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient"%>
<script Language="c#" runat="server">
void Page_Load(Object Source, EventArgs E)
{
	//
	String sDrugId;
	String sName;
	String sPyName;
	String sType;
	String sBatch;
	String sToDate;
	String sUnit;
	String sPrice;
	String sBatchPrice;
 	String sProductAddress;
	String sStoreCount;
	String sModifyFlag;
	String sABType;

//
	sDrugId=Request.Form["idDrugIdHide"].ToString();
	sName=Request.Form["idName"].ToString();
	sPyName=Request.Form["idPYName"].ToString();
	sType=Request.Form["idType"].ToString();
	sBatch=Request.Form["idBatch"].ToString();
	sToDate=Request.Form["idToDate"].ToString();
	sUnit=Request.Form["idUnit"].ToString();
	sPrice=Request.Form["idPrice"].ToString();
	sBatchPrice=Request.Form["idBatchPrice"].ToString();
	sProductAddress=Request.Form["idProductAddress"].ToString();
	sStoreCount=Request.Form["idStoreCount"].ToString();
	sModifyFlag=Request.Form["idModifyFlag"].ToString();
	sABType=Request.Form["idABType"].ToString();

	idModifyFlag.Value=sModifyFlag;


	//
	String sCon="server=localhost;database=_hospital;uid=sa;pwd=;Trusted_Connection=yes";

	//
	if(sModifyFlag=="0")  // 如果是增加
	{
		String sValueStr="";
		sValueStr="'"+sName+"','"+sPyName+"','"+sType+"','"+sBatch+"','"+sToDate+"','"+sUnit+"','"+sPrice+"','"+sBatchPrice+"','"+sProductAddress+"','"+sStoreCount+"',default,'"+sABType+"'";
	//
		//
		String sSql="";
		sSql="Insert into tb_DrugStore  values ("+sValueStr+")";
		SqlConnection OCon=new SqlConnection(sCon);
		SqlCommand OCmd=new SqlCommand(sSql,OCon);
		OCmd.Connection.Open();
		OCmd.ExecuteNonQuery();

		sSql="SELECT  @@IDENTITY  AS  'Identity'";
		SqlDataReader dr;
		OCmd=new SqlCommand(sSql,OCon);
		dr=OCmd.ExecuteReader();
		if(dr.Read())
		{
			idDrugCode.Value=dr["Identity"].ToString();
			dr.Close();
		}

		OCon.Close();
	}
	else    // 修改信息
	{
		String sSql="";
		sSql="update tb_DrugStore set Name='"+sName+"',PyName='"+sPyName+"',Type='"+sType+"',BatchCode='"+sBatch+"',ToDate='"+sToDate+"',Unit='"+sUnit+"',Price='"+sPrice+"',BatchPrice='"+sBatchPrice+"',ProductAddress='"+sProductAddress+"',StoreCount='"+sStoreCount+"',ABType='"+sABType+"' where AutoId="+sDrugId;
		SqlConnection OCon=new SqlConnection(sCon);
		SqlCommand OCmd=new SqlCommand(sSql,OCon);
		OCmd.Connection.Open();
		OCmd.ExecuteNonQuery();
		OCon.Close();
	}

	//
}
</script>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function _init2Db()
{
	if(idModifyFlag.value=="0")
	{
		parent.idDrugCode.innerText=Number(idDrugCode.value)+1;
		parent.idNewDrugCode.value=Number(idDrugCode.value)+1;
	}
	else
	{
		parent.idDrugCode.innerText=parent.idNewDrugCode.value;
	}

	parent._clearTable();

	//
	alert("入库成功!");
}

//-->
</SCRIPT>
</head>

<body onContextMenu='return false'  leftmargin=0 topmargin=0   ondragstart='return false' onselectstart ='return false' onselect='document.selection.empty()' oncopy='document.selection.empty()' onbeforecopy='return false'   onLoad="_init2Db()">
<INPUT TYPE="text" id="idDrugCode" style="display:none;" runat="server"/>
<INPUT TYPE="text" id="idModifyFlag" style="display:none;" runat="server"/>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -