Exemplo n.º 1
0
 static string Select(Person model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select  top 1 id,username,password,age,registerDate,address from Person ");
     strSql.Append(" where id=@id");
     return SqlStatementHelper.SqlBuilder(strSql.ToString(), model);
 }
Exemplo n.º 2
0
 static string Insert(Person model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("insert into Person(");
     strSql.Append("username,password,age,registerDate,address)");
     strSql.Append(" values (");
     strSql.Append("@username,@password,@age,@registerDate,@address)");
     return SqlStatementHelper.SqlBuilder(strSql.ToString(), model);
 }
Exemplo n.º 3
0
 static string Update(Person model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("update Person set ");
     strSql.Append("username=@username,");
     strSql.Append("password=@password,");
     strSql.Append("age=@age,");
     strSql.Append("registerDate=@registerDate,");
     strSql.Append("address=@address");
     strSql.Append(" where id=@id");
     return SqlStatementHelper.SqlBuilder(strSql.ToString(), model);
 }
Exemplo n.º 4
0
 static void Main(string[] args)
 {
     var person = new Person
     {
         address = "xx,x-\"xxx",
         registerDate = DateTime.Now,
         id = 5
     };
     var strSelect = Select(person);
     Display(strSelect);
     var strInsert = Insert(person);
     Display(strInsert);
     var strUpdate = Update(person);
     Display(strUpdate);
     Pause();
 }