本文整理汇总了C#中SqlCeCommand.CreateParameter方法的典型用法代码示例。如果您正苦于以下问题:C# SqlCeCommand.CreateParameter方法的具体用法?C# SqlCeCommand.CreateParameter怎么用?C# SqlCeCommand.CreateParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlCeCommand
的用法示例。
在下文中一共展示了SqlCeCommand.CreateParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertDocumentNumbers
public void InsertDocumentNumbers(XmlResponseGetDocNumbersResult aResultGetDocNumbers)
{
using (SqlCeConnection sqlConnection = new SqlCeConnection(MyClass.ConnectionString))
{
sqlConnection.Open();
using (SqlCeTransaction sqlTran = sqlConnection.BeginTransaction())
{
try
{
using (SqlCeCommand sqlCommand = new SqlCeCommand("INSERT INTO WarehouseReceipt(No) " +
"VALUES (@No)", sqlConnection, sqlTran))
{
sqlCommand.CommandType = CommandType.Text;
SqlCeParameter param = sqlCommand.CreateParameter();
param.ParameterName = "@No";
sqlCommand.Parameters.Add(param);
for (Int32 k = 0; k < aResultGetDocNumbers.Documents.Count; k++)
{
sqlCommand.Parameters["@No"].Value = aResultGetDocNumbers.Documents.Document(k).No;
sqlCommand.ExecuteNonQuery();
}
}
sqlTran.Commit();
}
catch
{
sqlTran.Rollback();
throw;
}
}
}
}
示例2: AddParameter
/// <summary>
/// add param
/// </summary>
/// <param name="sName">name</param>
/// <param name="value">value</param>
public void AddParameter(string sName, object value)
{
DbParameter dbPara = null;
SqlCeCommand cmd = new SqlCeCommand();
dbPara = cmd.CreateParameter();
dbPara.ParameterName = sName;
dbPara.Value = value;
parameters.Add(dbPara);
}
示例3: FillBinContent
public void FillBinContent(XmlResponseGetBinContentResult aXmlResponseResultGetBinContent)
{
using (SqlCeConnection sqlConnection = new SqlCeConnection(MyClass.ConnectionString))
{
sqlConnection.Open();
using (SqlCeTransaction sqlTran = sqlConnection.BeginTransaction())
{
try
{
using (SqlCeCommand sqlCommand = new SqlCeCommand("DELETE FROM BinContent", sqlConnection, sqlTran))
{
sqlCommand.CommandType = CommandType.Text;
sqlCommand.ExecuteNonQuery();
}
using (SqlCeCommand sqlCommand = new SqlCeCommand("INSERT INTO BinContent (ItemNo, ItemNo2, BinCode, Quantity, [Fixed], [Default]) " +
"VALUES (@ItemNo, @ItemNo2, @BinCode, @Quantity, @Fixed, @Default)", sqlConnection, sqlTran))
{
sqlCommand.CommandType = CommandType.Text;
sqlCommand.Parameters.Add(new SqlCeParameter("@ItemNo", aXmlResponseResultGetBinContent.BinContent.ItemNo));
sqlCommand.Parameters.Add(new SqlCeParameter("@ItemNo2", aXmlResponseResultGetBinContent.BinContent.ItemNo2));
SqlCeParameter param = sqlCommand.CreateParameter();
param.ParameterName = "@BinCode";
sqlCommand.Parameters.Add(param);
param = sqlCommand.CreateParameter();
param.ParameterName = "@Quantity";
sqlCommand.Parameters.Add(param);
param = sqlCommand.CreateParameter();
param.ParameterName = "@Fixed";
sqlCommand.Parameters.Add(param);
param = sqlCommand.CreateParameter();
param.ParameterName = "@Default";
sqlCommand.Parameters.Add(param);
for (Int32 k = 0; k < aXmlResponseResultGetBinContent.BinContent.Count; k++)
{
sqlCommand.Parameters["@BinCode"].Value = aXmlResponseResultGetBinContent.BinContent.Item(k).BinCode;
sqlCommand.Parameters["@Quantity"].Value = aXmlResponseResultGetBinContent.BinContent.Item(k).Quantity;
sqlCommand.Parameters["@Fixed"].Value = aXmlResponseResultGetBinContent.BinContent.Item(k).Fixed;
sqlCommand.Parameters["@Default"].Value = aXmlResponseResultGetBinContent.BinContent.Item(k).Default;
sqlCommand.ExecuteNonQuery();
}
}
sqlTran.Commit();
}
catch
{
sqlTran.Rollback();
throw;
}
}
}
}