本文整理汇总了C#中DataAccess.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.Insert方法的具体用法?C# DataAccess.Insert怎么用?C# DataAccess.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataAccess
的用法示例。
在下文中一共展示了DataAccess.Insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Creates this instance.
/// </summary>
/// <remarks></remarks>
public void Create()
{
var db = new DataAccess();
var existingRole = db.Get<Role>(RoleName);
if (existingRole != null)
throw new Exception("A role with that name already exists.");
db.Insert(RoleName,this);
}
示例2: AddEmployee
public List<DA.Employee> AddEmployee(DA.Employee employee)
{
List<DA.Employee> eList;
Thread.Sleep(TimeSpan.FromSeconds(1));
using (SqlConnection conn = new SqlConnection(_connectionString))
{
conn.Open();
using (SqlTransaction txn = conn.BeginTransaction())
{
int newId;
int numRows = employee.Insert(conn, txn, out newId);
eList = DA.Employee.GetAll(conn, txn);
txn.Commit();
}
}
return eList;
}
示例3: createOperation
// метод для создания операции в базу данных
private void createOperation()
{
DataAccess db = new DataAccess();
Operation operation = new Operation();
operation.Content = ViewState["content"].ToString();
ViewState["content"] = null;
operation.Created_at = DateTime.Now;
db.Insert(operation);
}
示例4: Create
/// <summary>
/// Creates this instance.
/// </summary>
/// <remarks></remarks>
public void Create()
{
/*
* First check to see if a user with the same e-mail address exists
* if a user exists throw an exception.
*/
var db = new DataAccess();
var existingUser = db.Get<User>(EMailAddress);
if (existingUser != null)
{
throw new Exception("User with this e-mail address already exists.");
}
db.Insert(EMailAddress, this);
}