本文整理汇总了C#中Srvtools.InfoCommand.CreateParameter方法的典型用法代码示例。如果您正苦于以下问题:C# InfoCommand.CreateParameter方法的具体用法?C# InfoCommand.CreateParameter怎么用?C# InfoCommand.CreateParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Srvtools.InfoCommand
的用法示例。
在下文中一共展示了InfoCommand.CreateParameter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateADUsers
public object UpdateADUsers(object[] objParam)
{
String[] strAdUsers = objParam[0].ToString().Split(new String[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
object[] myRet = (object[])GetADUsers(null);
ArrayList alADUsers = myRet[1] as ArrayList;
ClientType ct = ClientType.ctMsSql;
IDbConnection nwindConn = AllocateConnection(GetClientInfo(ClientInfoType.LoginDB).ToString(), ref ct, false);
try
{
foreach (String strADUser in strAdUsers)
{
foreach (ADUser user in alADUsers)
{
if (strADUser == user.ID)
{
InfoCommand cmd = new InfoCommand(ClientInfo);
cmd.Connection = nwindConn;
if (ct == ClientType.ctMsSql || ct == ClientType.ctMySql)
{
cmd.CommandText = "DELETE FROM USERS WHERE [email protected]";
IDbDataParameter idpUSERID = cmd.CreateParameter();
idpUSERID.ParameterName = "@USERID";
idpUSERID.Value = user.ID;
cmd.Parameters.Add(idpUSERID);
}
else if (ct == ClientType.ctOleDB || ct == ClientType.ctSybase || ct == ClientType.ctODBC || ct == ClientType.ctInformix)
{
cmd.CommandText = "DELETE FROM USERS WHERE USERID=?";
IDbDataParameter idpUSERID = cmd.CreateParameter();
idpUSERID.ParameterName = "?";
idpUSERID.Value = user.ID;
cmd.Parameters.Add(idpUSERID);
}
else if (ct == ClientType.ctOracle)
{
cmd.CommandText = "DELETE FROM USERS WHERE USERID=:USERID";
IDbDataParameter idpUSERID = cmd.CreateParameter();
idpUSERID.ParameterName = ":USERID";
idpUSERID.Value = user.ID;
cmd.Parameters.Add(idpUSERID);
}
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
if (ct == ClientType.ctMsSql || ct == ClientType.ctMySql)
{
cmd.CommandText = "INSERT INTO USERS (USERID, USERNAME, DESCRIPTION, AUTOLOGIN, EMAIL, MSAD, CREATEDATE) " +
"VALUES (@USERID, @USERNAME, @DESCRIPTION, 'S', @EMAIL, 'Y', @CREATEDATE)";
IDbDataParameter idpUSERID = cmd.CreateParameter();
idpUSERID.ParameterName = "@USERID";
idpUSERID.Value = user.ID;
IDbDataParameter idpUSERNAME = cmd.CreateParameter();
idpUSERNAME.ParameterName = "@USERNAME";
idpUSERNAME.Value = user.Name;
IDbDataParameter idpDESCRIPTION = cmd.CreateParameter();
idpDESCRIPTION.ParameterName = "@DESCRIPTION";
idpDESCRIPTION.Value = user.Description;
IDbDataParameter idpEMAIL = cmd.CreateParameter();
idpEMAIL.ParameterName = "@EMAIL";
idpEMAIL.Value = user.Email;
IDbDataParameter idpCREATEDATE = cmd.CreateParameter();
idpCREATEDATE.ParameterName = "@CREATEDATE";
idpCREATEDATE.Value = DateTime.Today.ToString("yyyyMMdd");
cmd.Parameters.Add(idpUSERID);
cmd.Parameters.Add(idpUSERNAME);
cmd.Parameters.Add(idpDESCRIPTION);
cmd.Parameters.Add(idpEMAIL);
cmd.Parameters.Add(idpCREATEDATE);
}
else if (ct == ClientType.ctOleDB || ct == ClientType.ctSybase || ct == ClientType.ctODBC || ct == ClientType.ctInformix)
{
cmd.CommandText = "INSERT INTO USERS (USERID, USERNAME, DESCRIPTION, AUTOLOGIN, EMAIL, MSAD, CREATEDATE) " +
"VALUES (?, ?, ?, 'S', ?, 'Y', ?)";
IDbDataParameter idpUSERID = cmd.CreateParameter();
idpUSERID.ParameterName = "?";
idpUSERID.Value = user.ID;
IDbDataParameter idpUSERNAME = cmd.CreateParameter();
idpUSERNAME.ParameterName = "?";
idpUSERNAME.Value = user.Name;
IDbDataParameter idpDESCRIPTION = cmd.CreateParameter();
idpDESCRIPTION.ParameterName = "?";
idpDESCRIPTION.Value = user.Description;
IDbDataParameter idpEMAIL = cmd.CreateParameter();
idpEMAIL.ParameterName = "?";
idpEMAIL.Value = user.Email;
IDbDataParameter idpCREATEDATE = cmd.CreateParameter();
idpCREATEDATE.ParameterName = "?";
idpCREATEDATE.Value = DateTime.Today.ToString("yyyyMMdd");
cmd.Parameters.Add(idpUSERID);
//.........这里部分代码省略.........
示例2: UpdateADGroups
public object UpdateADGroups(object[] objParam)
{
String[] strAdGroups = objParam[0].ToString().Split(new String[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
object[] myRet = (object[])GetADUserForGroup(null);
ArrayList alADGroups = myRet[1] as ArrayList;
ClientType ct = ClientType.ctMsSql;
IDbConnection nwindConn = AllocateConnection(GetClientInfo(ClientInfoType.LoginDB).ToString(), ref ct, false);
try
{
foreach (String strADGroup in strAdGroups)
{
foreach (ADGroup group in alADGroups)
{
if (strADGroup == group.ID)
{
InfoCommand cmd = new InfoCommand(ClientInfo);
cmd.Connection = nwindConn;
if (ct == ClientType.ctMsSql || ct == ClientType.ctMySql)
{
cmd.CommandText = "DELETE FROM GROUPS WHERE [email protected]";
IDbDataParameter idpGROUPNAME = cmd.CreateParameter();
idpGROUPNAME.ParameterName = "@GROUPNAME";
idpGROUPNAME.Value = group.ID;
cmd.Parameters.Add(idpGROUPNAME);
}
else if (ct == ClientType.ctOleDB || ct == ClientType.ctSybase || ct == ClientType.ctODBC || ct == ClientType.ctInformix)
{
cmd.CommandText = "DELETE FROM GROUPS WHERE GROUPNAME=?";
IDbDataParameter idpGROUPNAME = cmd.CreateParameter();
idpGROUPNAME.ParameterName = "?";
idpGROUPNAME.Value = group.ID;
cmd.Parameters.Add(idpGROUPNAME);
}
else if (ct == ClientType.ctOracle)
{
cmd.CommandText = "DELETE FROM GROUPS WHERE GROUPNAME=:GROUPNAME";
IDbDataParameter idpGROUPNAME = cmd.CreateParameter();
idpGROUPNAME.ParameterName = ":GROUPNAME";
idpGROUPNAME.Value = group.ID;
cmd.Parameters.Add(idpGROUPNAME);
}
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
if (ct == ClientType.ctMsSql || ct == ClientType.ctMySql)
{
cmd.CommandText = "INSERT INTO GROUPS (GROUPID, GROUPNAME, DESCRIPTION, MSAD) " +
"VALUES (@GROUPID, @GROUPNAME, @DESCRIPTION, 'Y')";
IDbDataParameter idpGROUPID = cmd.CreateParameter();
idpGROUPID.ParameterName = "@GROUPID";
idpGROUPID.Value = "ad" + GetGroupID().ToString("000");
IDbDataParameter idpGROUPNAME = cmd.CreateParameter();
idpGROUPNAME.ParameterName = "@GROUPNAME";
idpGROUPNAME.Value = group.ID;
IDbDataParameter idpDESCRIPTION = cmd.CreateParameter();
idpDESCRIPTION.ParameterName = "@DESCRIPTION";
idpDESCRIPTION.Value = group.Description;
cmd.Parameters.Add(idpGROUPID);
cmd.Parameters.Add(idpGROUPNAME);
cmd.Parameters.Add(idpDESCRIPTION);
}
else if (ct == ClientType.ctOleDB || ct == ClientType.ctSybase || ct == ClientType.ctODBC || ct == ClientType.ctInformix)
{
cmd.CommandText = "INSERT INTO GROUPS (GROUPID, GROUPNAME, DESCRIPTION, MSAD) " +
"VALUES (?, ?, ?, 'Y')";
IDbDataParameter idpGROUPID = cmd.CreateParameter();
idpGROUPID.ParameterName = "?";
idpGROUPID.Value = "ad" + GetGroupID().ToString("000");
IDbDataParameter idpGROUPNAME = cmd.CreateParameter();
idpGROUPNAME.ParameterName = "?";
idpGROUPNAME.Value = group.ID;
IDbDataParameter idpDESCRIPTION = cmd.CreateParameter();
idpDESCRIPTION.ParameterName = "?";
idpDESCRIPTION.Value = group.Description;
cmd.Parameters.Add(idpGROUPID);
cmd.Parameters.Add(idpGROUPNAME);
cmd.Parameters.Add(idpDESCRIPTION);
}
else if (ct == ClientType.ctOracle)
{
cmd.CommandText = "INSERT INTO GROUPS (GROUPID, GROUPNAME, DESCRIPTION, MSAD) " +
"VALUES (:GROUPID, :GROUPNAME, :DESCRIPTION, 'Y')";
IDbDataParameter idpGROUPID = cmd.CreateParameter();
idpGROUPID.ParameterName = ":GROUPID";
idpGROUPID.Value = "ad" + GetGroupID().ToString("000");
IDbDataParameter idpGROUPNAME = cmd.CreateParameter();
idpGROUPNAME.ParameterName = ":GROUPNAME";
idpGROUPNAME.Value = group.ID;
IDbDataParameter idpDESCRIPTION = cmd.CreateParameter();
idpDESCRIPTION.ParameterName = ":DESCRIPTION";
idpDESCRIPTION.Value = group.Description;
//.........这里部分代码省略.........