public void InsertSingle(LoanetBookObject obj)
        {
            //Change to SP if required
            string sql = @"INSERT INTO LoanetBook(BookName, BookNumber, LoanetZone, FileName, Active) VALUES(@BookName, @BookNumber, @LoanetZone, @FileName, @Active)";

            using (SqlConnection conn = new SqlConnection(cstr))
            {
                SqlCommand cmd = new SqlCommand(sql, conn);
                //cmd.CommandType=CommandType.StoredProcedure;

                //cmd.Parameters.AddWithValue(",");


                cmd.Parameters.AddWithValue("@BookName", SetNullValue(obj.BookName));
                cmd.Parameters.AddWithValue("@BookNumber", SetNullValue(obj.BookNumber));
                cmd.Parameters.AddWithValue("@LoanetZone", SetNullValue(obj.LoanetZone));
                cmd.Parameters.AddWithValue("@FileName", SetNullValue(obj.FileName));
                cmd.Parameters.AddWithValue("@Active", SetNullValue(obj.Active));

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }

                //Only use whats in catch block if you included Log.cs
                catch (SqlException ex)
                {
                    //Utils.LogError(ex.Message);
                    throw;
                }
            }
        }
 public void Replicate(LoanetBookObject x)
 {
     this.BookName   = x.BookName;
     this.BookNumber = x.BookNumber;
     this.LoanetZone = x.LoanetZone;
     this.FileName   = x.FileName;
     this.Active     = x.Active;
 }
Ejemplo n.º 3
0
 public void InsertSingle(LoanetBookObject obj)
 {
     DA.InsertSingle(obj);
 }