今天是我接触vs第一天,经理给我一程序是先前程序员留下的。让我修改一番。
但是,
我不清楚的地方是:
问题在代码里找啊??请高手在下述代码注释中,找一下。
protected string FWSP_LocationPallet()
{
WMSDAL.DataAccess.SQLDataAccess pSDA = new SQLDataAccess(pSqlConStr);
string pStrSQL = string.Empty, pStrRet = string.Empty;
SqlCommand scSqlComd = null; SqlTransaction pSqlTran = null;
string[] pArrLoc = null;
BCMainProcess pDCM = new BCMainProcess(mUserID); int pCmdRet = 0; try
{
pSDA.BeginTrans();
pSqlTran = pSDA.tran;
System.Data.SqlClient.SqlParameter spReturn = new System.Data.SqlClient.SqlParameter();
System.Data.SqlClient.SqlParameter outMsg = new System.Data.SqlClient.SqlParameter();
string strMsg = "";
// pStrSQL = "Update SE_CONT_HEAD Set SCH_PALLET_BARCODE = @strPalletCode, SCH_UPDATE_USER_ID = @strOpCode, SCH_UPDATE_DATE = getdate() Where SCH_AS_UCN = @strCtnCode";//这里一,这里一,这里一,这里一,这里一,这里一,这里一,
//如果此sql未注释,我能看懂,就是执行一条sql语句,但是为什么要把此语句注释起来,换成了,下面这句
pStrSQL = "webReceiveLocationPallet";//这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二
//这是一个存储过程吗?我也未找到,这是一个什么 scSqlComd = new SqlCommand(pStrSQL, pSDA.ActiveCN);
scSqlComd.CommandType = CommandType.StoredProcedure;
//scSqlComd.CommandText = "ReceiveCtnPallet";
scSqlComd.Transaction = pSqlTran; scSqlComd.Parameters.Add("@vLocation", SqlDbType.VarChar, 30).Value = TxtLocationCode.Text.Trim();
scSqlComd.Parameters.Add("@strOpCode", SqlDbType.VarChar, 30).Value = mUserID;
scSqlComd.Parameters.Add("@strPalletCode", SqlDbType.VarChar, 30).Value = TxtPalletCode.Text.Trim();
//scSqlComd.Parameters.Add("@strMsg", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output;
outMsg.ParameterName = "strMsg";
outMsg.Direction = ParameterDirection.Output;
outMsg.SqlDbType = SqlDbType.VarChar;
outMsg.Size = 50;
scSqlComd.Parameters.Add(outMsg);
spReturn.Direction = ParameterDirection.ReturnValue;
spReturn.SqlDbType = SqlDbType.Int;
scSqlComd.Parameters.Add(spReturn);
scSqlComd.ExecuteNonQuery();
pCmdRet = (int)spReturn.Value;
strMsg = outMsg.Value.ToString();
pStrRet = strMsg;// "更新箱子成功!";
if (pCmdRet != 0)
{
pSqlTran.Rollback();
pStrRet = strMsg;
HFErr.Value = pStrRet;
return pStrRet;
}
pSqlTran.Commit(); if (ChkKeepLocation.Checked == false)
{
TxtLocationCode.Text = string.Empty;
}
TxtPalletCode.Text = string.Empty; HFErr.Value = string.Empty;
pStrRet += RetCount(); }
catch (Exception pEx)
{
pStrRet = CommonEx.FC_GetErrString(pEx);
pStrRet = "操作失败!";
pSqlTran.Rollback();
HFErr.Value = pStrRet;
}
finally
{
scSqlComd = null;
pSDA.Dispose();
pSDA = null;
} return pStrRet; }
但是,
我不清楚的地方是:
问题在代码里找啊??请高手在下述代码注释中,找一下。
protected string FWSP_LocationPallet()
{
WMSDAL.DataAccess.SQLDataAccess pSDA = new SQLDataAccess(pSqlConStr);
string pStrSQL = string.Empty, pStrRet = string.Empty;
SqlCommand scSqlComd = null; SqlTransaction pSqlTran = null;
string[] pArrLoc = null;
BCMainProcess pDCM = new BCMainProcess(mUserID); int pCmdRet = 0; try
{
pSDA.BeginTrans();
pSqlTran = pSDA.tran;
System.Data.SqlClient.SqlParameter spReturn = new System.Data.SqlClient.SqlParameter();
System.Data.SqlClient.SqlParameter outMsg = new System.Data.SqlClient.SqlParameter();
string strMsg = "";
// pStrSQL = "Update SE_CONT_HEAD Set SCH_PALLET_BARCODE = @strPalletCode, SCH_UPDATE_USER_ID = @strOpCode, SCH_UPDATE_DATE = getdate() Where SCH_AS_UCN = @strCtnCode";//这里一,这里一,这里一,这里一,这里一,这里一,这里一,
//如果此sql未注释,我能看懂,就是执行一条sql语句,但是为什么要把此语句注释起来,换成了,下面这句
pStrSQL = "webReceiveLocationPallet";//这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二,这里二
//这是一个存储过程吗?我也未找到,这是一个什么 scSqlComd = new SqlCommand(pStrSQL, pSDA.ActiveCN);
scSqlComd.CommandType = CommandType.StoredProcedure;
//scSqlComd.CommandText = "ReceiveCtnPallet";
scSqlComd.Transaction = pSqlTran; scSqlComd.Parameters.Add("@vLocation", SqlDbType.VarChar, 30).Value = TxtLocationCode.Text.Trim();
scSqlComd.Parameters.Add("@strOpCode", SqlDbType.VarChar, 30).Value = mUserID;
scSqlComd.Parameters.Add("@strPalletCode", SqlDbType.VarChar, 30).Value = TxtPalletCode.Text.Trim();
//scSqlComd.Parameters.Add("@strMsg", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output;
outMsg.ParameterName = "strMsg";
outMsg.Direction = ParameterDirection.Output;
outMsg.SqlDbType = SqlDbType.VarChar;
outMsg.Size = 50;
scSqlComd.Parameters.Add(outMsg);
spReturn.Direction = ParameterDirection.ReturnValue;
spReturn.SqlDbType = SqlDbType.Int;
scSqlComd.Parameters.Add(spReturn);
scSqlComd.ExecuteNonQuery();
pCmdRet = (int)spReturn.Value;
strMsg = outMsg.Value.ToString();
pStrRet = strMsg;// "更新箱子成功!";
if (pCmdRet != 0)
{
pSqlTran.Rollback();
pStrRet = strMsg;
HFErr.Value = pStrRet;
return pStrRet;
}
pSqlTran.Commit(); if (ChkKeepLocation.Checked == false)
{
TxtLocationCode.Text = string.Empty;
}
TxtPalletCode.Text = string.Empty; HFErr.Value = string.Empty;
pStrRet += RetCount(); }
catch (Exception pEx)
{
pStrRet = CommonEx.FC_GetErrString(pEx);
pStrRet = "操作失败!";
pSqlTran.Rollback();
HFErr.Value = pStrRet;
}
finally
{
scSqlComd = null;
pSDA.Dispose();
pSDA = null;
} return pStrRet; }
返回成功
// pStrSQL =
是不是表示,不执行pStrSQL,