Categories
- Programing (5)
- إسلاميات (3)
- اقتصاد (2)
- الإعجاز العلمي (1)
- تنمية بشرية (16)
- معلومات عامة (1)
Thursday, September 03, 2020
Tuesday, July 21, 2020
Monday, December 23, 2019
Monday, August 05, 2019
Friday, December 11, 2009
Pyramids of Egypt
Building of the Great pyramid of Giza
It is believed the pyramid was built as a tomb for Fourth dynasty Egyptian pharaoh Khufu and constructed over a 14[2] to 20 year period concluding around 2540 BC.[3] Khufu's vizier, Hemon, or Hemiunu, is believed by some to be the architect of the Great Pyramid.[4] It is thought that, at construction, the Great Pyramid was originally 280 Egyptian cubits tall, 146.59 metres (480.94 ft) but with erosion and the loss of its pyramidion, its current height is 138.74 metres (455.18 ft). Each base side was 440 royal cubits, 230.37 metres (755.81 ft) in length. A royal cubit measures 0.524 meters.[5] The total mass of the pyramid is estimated at 5.9 million tonnes. The volume, including an internal hillock, is believed to be roughly 2,500,000 cubic meters.[6] Based on these estimates, building this in 20 years would involve installing approximately 800 tonnes of stone every day. The first precision measurements of the pyramid were done by Egyptologist Sir Flinders Petrie in 1880–82 and published as The Pyramids and Temples of Gizeh.[7] Almost all reports are based on his measurements. Many of the casing stones and interior chamber blocks of the Great Pyramid were fit together with extremely high precision. Based on measurements taken on the north eastern casing stones, the mean opening of the joints are only 0.5 millimeters wide (1/50th of an inch).[8]
The pyramid remained the tallest man-made structure in the world for over 3,800 years,[9] unsurpassed until the 160 meter tall spire of Lincoln Cathedral was completed c. 1300. The accuracy of the pyramid's workmanship is such that the four sides of the base have a mean error of only 58 millimeter in length [10] The base is horizontal and flat to within 15 mm. The sides of the square base are closely aligned to the four cardinal compass points (within 4 minutes of arc)[11] based on true north, not magnetic north[12], and the finished base was squared to a mean corner error of only 12 seconds of arc[13]. The completed design dimensions, as suggested by Petrie's survey and later studies, are estimated to have originally been 280 cubits in height by 440 cubits in length at each of the four sides of its base. These proportions equate to π/2 to an accuracy of better than 0.05% (corresponding to the approximation of π as 22/7). Some Egyptologists consider this to have been the result of deliberate design proportion[14]. Verner wrote, "We can conclude that although the ancient Egyptians could not precisely define the value of π, in practise they used it".[15] Petrie, author of ‘The Pyramids and Temples of Gizeh', who was the first accurate surveyor of Giza and the excavator and surveyor of the Pyramid of Meidum, concluded: "but these relations of areas and of circular ratio are so systematic that we should grant that they were in the builders design".[16] Earlier in the chapter he wrote more specifically, that: “We conclude therefore that the approximation of 7 to 22 as the ratio of diameter to circumference was recognised”.[17] These proportions equated to the four outer faces sloping by approximately 51.842º or 51º 50' 35", which would have been understood and expressed by the Ancient Egyptians as a seked slope of 5 1/2 palms [18].
Giza's Materials
- See also: Calculating the weight of megaliths
The Great Pyramid consists of more than 2.3 million limestone blocks. The Egyptians obtained the majority of the limestone blocks from a nearby quarry. The Tufa limestone used for the casing was quarried across the river. The largest granite stones in the pyramid, found in the "King's" chamber, weigh 25 to 80 tonnes and were transported more than 500 miles away from Aswan. Traditionally, ancient Egyptians cut stone blocks by hammering wedges into the stone which were then soaked with water. The wedges expanded, causing the rock to crack. Once they were cut, they were carried by boat either up or down the Nile River to the pyramid.[19]
Casing stones
At completion, the Great Pyramid was surfaced by white 'casing stones' – slant-faced, but flat-topped, blocks of highly polished white limestone. These were carefully cut to what is approximately a face slope with a seked of 5 1/2 palms to give the required overall dimensions. Visibly, all that remains is the underlying step-pyramid core structure seen today. In AD 1301, a massive earthquake loosened many of the outer casing stones, which were then carted away by Bahri Sultan An-Nasir Nasir-ad-Din al-Hasan in 1356 in order to build mosques and fortresses in nearby Cairo. The stones can still be seen as parts of these structures to this day. Later explorers reported massive piles of rubble at the base of the pyramids left over from the continuing collapse of the casing stones, which were subsequently cleared away during continuing excavations of the site. Nevertheless, many of the casing stones can be seen to this day in situ around the base of the Great Pyramid, and display the same workmanship and precision as has been reported for centuries. Petrie also found a different orientation in the core and in the casing measuring 193 centimeters ± 25 centimeters. He suggested a redetermination of north was made after the construction of the core, but a mistake was made, and the casing was built with a different orientation.[20] Petrie related the precision of the casing stones as to being "equal to opticians' work of the present day, but on a scale of acres." and "to place such stones in exact contact would be careful work; but to do so with cement in the joints seems almost impossible."[21]
Construction theories
Many alternative, often contradictory, theories have been proposed regarding the Pyramid's construction techniques.[22] Not all even agree that the blocks were quarried, they might conceivably have been cast[citation needed]. However, most accept it was built by moving huge stones from a quarry, being only unable to agree whether they were dragged, lifted or even rolled into place. The Greeks believed that slave labour was used but modern Egyptologists accept that it was built by many tens of thousands of skilled workers. They camped near the pyramids and worked for a salary or as a form of paying taxes until the construction was completed.[citation needed] Their cemeteries were discovered in 1990 by archaeologists Zahi Hawass and Mark Lehner. Verner posited that the labor was organized into a hierarchy, consisting of two gangs of 100,000 men, divided into five zaa or phyle of 20,000 men each, which may have been further divided according to the skills of the workers.[23]
One of the mysteries of the pyramid's construction is how they planned its construction. John Romer suggests that they used the same method that had been used for earlier and later constructions, laying out parts of the plan on the ground at a 1 to 1 scale. He writes that "such a working diagram would also serve to generate the architecture of the pyramid with a precision unmatched by any other means." He devotes a chapter of his book to the physical evidence that there was such a plan.[24]
Interior
The Great Pyramid is the only pyramid known to contain both ascending and descending passages. There are three known chambers inside the Great Pyramid. These are arranged centrally, on the vertical axis of the pyramid. From the entrance, an 18 meter corridor leads down and splits in two directions. One way leads to the lowest and unfinished chamber. This chamber is cut into the bedrock upon which the pyramid was built. It is the largest of the three, but totally unfinished, only rough-cut into the rock. The other passage leads to the Grand Gallery (49 m x 3 m x 11 m), where it splits again. One tunnel leads to the Queen's Chamber, a misnomer, while the other winds to intersect with the descending corridor. The Grand Gallery itself features a corbel haloed design and several cut "sockets" spaced at regular intervals along the length of each side of its raised base with a "trench" running along its center length at floor level. What purpose these sockets served is unknown. An antechamber leads from the Grand Gallery to the King's Chamber.[3]
Entrance
Today, tourists enter the Great Pyramid via a forced tunnel dug by the Caliph Al-Ma'mum and his men around 820 AD. The tunnel continues for approximately 30 meters and eventually meets up with the Descending Passage which at the time was found to have been blocked by a series of massive granite plugs. Unable to remove the blocks, the workmen tunneled around the plugs discovering the Ascending Passage which leads to the Grand Gallery and interior chambers only to find them empty. The original entrance, which was apparently unknown at the time, can be seen today several meters directly above the forced entry and would have also been blocked by the granite plugs.
King's Chamber
At the end of the lengthy series of entrance ways leading into the interior is the structure's main chamber, the King's Chamber. This granite room was originally 10 × 20 × 11.4 cubits, or about 5.235 m × 10.47 m × 5.974 m[25][26], comprising a double 10 × 10 cubit square floor, and a height equal to half the double square's diagonal. Some believed that the height was consistent with the geometric methods for determining the Golden Ratio φ (phi) as the height is approximately phi times the width minus ½, while phi can be derived from other dimensions of the pyramid[27], but evidence from Petrie’s surveys and later conclusions drawn by others shows that it was in fact the circular proportions that were deliberately incorporated into the internal and external designs of the Great Pyramid by its architects and builders, for symbolic reasons[28]. The so called golden ratio phi simply exists in the proportions of the architecture as an inadvertent by-product of the inclusion of the circular proportions. The reason for the inadvertent inclusion is that phi, the golden ratio, has a naturally occurring mathematical relation to the circular ratio pi that is unrelated to the architecture or geometry, and which was unknown to the pyramid's builders. Petrie confirmed that the King’s Chamber was a triumph of Egyptian geometry, the ratio of its length to the circuit of the side wall being the same as the ratio of 1 to pi, and that the exterior of the pyramid had been built to the same proportions[28][29][30]
The sarcophagus of the King's Chamber was hollowed out of a single piece of Red Aswan granite and has been found to be too large to fit through the passageway leading to the chamber. Whether the sarcophagus was ever intended to house a body is unknown, and no lid has ever been found. The King's Chamber contains two small shafts that ascend out of the pyramid. Despite being originally discovered closed off at both ends, these shafts were once thought by Egyptologists to have been used as "ventilation shafts", but this idea was eventually abandoned, leaving them to conclude they were instead used for ceremonial purposes. It is now thought that they were to allow the Pharaoh's spirit to rise up and out to heaven.[31]
The King's Chamber is lined with red granite brought from Aswan 935 km (580 miles) to the south. There are 5 relieving chambers above the kings chamber. The first one is reached through a breach in the wall at the upper end of the Grand Gallery, this was named the Davidson chamber. Howard Vyse suspected there was another chamber above this when he found that he was able to thrust a long reed through a crack in the ceiling. He blasted through to find 4 more relieving chambers. These chambers were named the Wellington, Nelson, Lady Arbuthnot and Cambell's chambers. The kings chamber and the first 4 relieving chambers have roofs made out of granite. Each roof includes 8 or 9 granite slabs weighing 25 to 80 tonnes each. Cambell's chamber has a pented roof made of large limestone slabs.[32][33] Egyptologists believe they were transported on barges down the Nile river.[34]
Queen's Chamber
The Queen's Chamber is the middle and the smallest, measuring approximately 5.74 by 5.23 meters, and 4.57 meters in height. The chamber is lined with fine limestone blocks and the pented roof is made of large limestone slabs.[35] Its eastern wall has a large angular doorway or niche. Egyptologist Mark Lehner believes that the Queen's chamber was intended as a serdab, a structure found in several other Egyptian pyramids, and that the niche would have contained a statue of the interred. The Ancient Egyptians believed that the statue would serve as a "back up" vessel for the Ka of the Pharaoh, should the original mummified body be destroyed. The true purpose of the chamber, however, remains uncertain.[31] The Queens Chamber has a pair of shafts similar to those in the King's Chamber, which were explored using a robot, Upuaut 2, created by the German engineer Rudolf Gantenbrink. In 1992, Upuaut 2 discovered that these shafts were blocked by limestone "doors" with two eroded copper handles. The National Geographic Society filmed the drilling of a small hole in the southern door, only to find another larger door behind it.[36] The northern passage, which was harder to navigate due to twists and turns, was also found to be blocked by a door.[37]
Unfinished chamber
The "unfinished chamber" lies 27.5 meters below ground level and is rough-hewn, lacking the precision of the other chambers. Egyptologists suggest the chamber was intended to be the original burial chamber, but that King Khufu later changed his mind and wanted it to be higher up in the pyramid.[38] Egyptologist Bob Brier believes it was an insurance policy in case Khufu died early. When he was still alive and healthy after about 5 years of construction, the second (Queen's) chamber was begun. Sometime around the fifteenth year this chamber was also abandoned unfinished and the last or King's Chamber was built high up in the center of the pyramid.[39]
Pyramid complex
The Great Pyramid of Giza is the main part of a complex setting of buildings that included two mortuary temples in honor of Khufu (one close to the pyramid and one near the Nile), three smaller pyramids for Khufu's wives, an even smaller "satellite" pyramid, a raised causeway connecting the two temples, and small mastaba tombs surrounding the pyramid for nobles. One of the small pyramids contains the tomb of queen Hetepheres (discovered in 1925), sister and wife of Sneferu and the mother of Khufu. There was a town for the workers of Giza, which included a cemetery, bakeries, a beer factory and a copper smelting complex. A few hundred meters south-west of the Great Pyramid lies the slightly smaller Pyramid of Khafre, one of Khufu's successors who is also commonly considered the builder of the Great Sphinx, and a few hundred meters further south-west is the Pyramid of Menkaure, Khafre's successor, which is about half as tall. In May 1954, 41 blocking stones were uncovered close to the south side of the Great Pyramid. They covered a 30.8 meter long rock-cut pit that contained the remains of a 43 meter long ship of cedar wood. In antiquity, it had been dismantled into 650 parts comprising 1224 pieces. This funeral boat of Khufu has been reconstructed and is now housed in a museum on the site of its discovery. A second boat pit was later discovered nearby.[40]
Thieves, tourists and excavators
Although succeeding pyramids were smaller, pyramid building continued until the end of the Middle Kingdom. However, as authors Briar and Hobbs claim, "all the pyramids were robbed" by the New Kingdom, when the construction of royal tombs in a desert valley, now known as the Valley of the Kings, began.[41][42] Joyce Tyldesley states that the Great Pyramid itself "is known to have been opened and emptied by the Middle Kingdom", before the Arab caliph Abdullah Al Mamun entered the pyramid around AD 820Friday, November 20, 2009
How To Be Attractive To Women
If you're looking to get women, one of the hardest things to do is seduce them. Why would I say that? Well, because it is far easier to change yourself into the type of man that attracts women rather than going out and seducing them into thinking they're attracted to you.
Seduction has a place, that is for sure. But if you want to be successful, you must know how to be attractive to women. If you can manage this, your work is more than half done. All there is left is not messing anything up.
When you approach a woman, the last thing you should be thinking about is how to impress them. Women don't only want to be impressed by men. They want to be attracted to them first. If you fail to accomplish this, even if you get a chance to chat with them, you will fail. Attraction is a law that absolutely must be obeyed when it comes to relationships.
The easiest way to attract women is being confident and being charismatic. Yeah, yeah. I know. It must seem redundant, but like I say in my other articles, repetition is the key to mastery and the more you hear something, the more you're likely to use it.
So, how do women decide whether a man is confident or not? Over the years I have seen and have been guilty of doing things that poisoned any chance with a woman. I'm going to detail some of the "red-flags" that women look out for or are unconsciously avoiding when interacting with a man.
The first thing I would like to stress is the one thing women absolutely hate! This is, of course, is a man who's all over her and touches her way too much when they first begin socializing.
Hanging all over a woman is a mistake because it not only makes you look like a pervert, she will look at you as an insecure, needy man. The one thing you must ABSOLUTELY avoid.
A confident man doesn't show affection in the beginning stages of a relationship. He will stay cool and get to know a woman. After all, he projects the security that he can get any woman and will not rush into anything. He lets the woman do the touching and will read these touches like a true seduction master.
You want to make the women you meet crave your touch, not feel smothered by it. Sure, later on when you've made some good headway with a woman touching is very important. But early on, do everything you can to avoid it.
Another thing you should be aware of is how to use your passion. If you are a passionate guy, this may be difficult but crucial if you don't want to repulse a woman. When used effectively, passion could be what attracts a woman to you. This was the case with myself and how I attracted my girlfriend.
Stay passionate, but only with the things you love. Never go off on the things that bother you or anger you. Fueling these negative feelings with you will make you seem bitter and a woman will see you as a complainer.
Don't speak negatively about women, especially women from your past. I have read this advice over and over only to overhear a guy talking about how evil his ex was. Do you think women want a guy who, if it doesn't work out with him, will go off to others about how ridiculous she was? NO!
This goes for a lot more in life than just women, too. Speaking poorly about a past employer will give the impression that you are difficult to please and hard to get a long with. Women know this and is something they do not want to deal with.
Something else I've seen and cannot understand since I've never been the type, is to be a people pleaser. Trying to please everyone and accommodating everyone's needs shows that you are insecure and are looking for validation. A confident man knows he's cool and lets others find it out on their own. He doesn't market himself like a pitch page on the Internet.
When it comes to women, you don't want to be a puppy dog. A confident man has way too much pride than to obey everything that is asked of him. He will do only the things that he believes he should do and has the time for. You have to project the idea that you will never be used and are way too busy for meaningless demands.
On the other side of the coin, you don't want to be a prick. There are exceptions to every rule, so doing good things for people is not only okay, it's recommended. If you give the impression that you are selfish and inconsiderate, no woman will want to be with you.
Also, you don't want to be an attention whore. Saying and doing things that are obviously meant to receive attention is very unattractive. I know that people compare marketing yourself to women with talking about your strengths to a prospective employer, but nothing could be further from the truth. Instead of talking about your accomplishments and talents to a woman, you will have to learn how to show her.
I know that you must have heard somewhere that in order to be attractive to a woman you must be cocky and funny. Though not necessary, it will help you with a lot more than making a girl laugh. Unfortunately for a lot of men, they accomplish being either or and come across as either a clown or a cocky bastard.
When you are socializing with women, don't be outspoken. Excessive arguing is a turn off and makes you look as though you're close minded. If you don't agree with what a woman is saying, challenge her - don't tell her she's wrong. No woman (or man for that matter) wants to be told or made to feel as though their opinions are invalid or stupid.
If you ever do find yourself in a conversation with a woman who is trying to argue, don't return argument. Challenging her with something cocky and funny or find a way to change the subject immediately. There will be plenty of time to take part in debates later if you do find yourself in a relationship with her.
You know that saying "you can talk the talk, but can you walk the walk?" It's one you should really live by. Start showing people, especially women, what you can do and not talk about it. Actions, as most of you are already aware, are far more effective than words.
Confidence can projected way before even meeting a woman. If you are at a bar, for example, be the leader of your group and not one of the followers. Make the decisions and show all the women that are around that you are not needy. Women like a man who takes charge and find it annoying, stressful, and very unattractive when they are the ones deciding everything. Don't be that type of man.
Attraction is a lot deeper than just looking good. You have to know what women want, and what they don't want. There is a fine line between the two, and learning how to balance will work wonders for you. You want to show women that you are confident and not an ego maniac. Finding this middle ground will not only make you more attractive to women you are interested in, it will also help with your interactions with everyone else.
Being attractive through confidence and security is not only a seduction technique, it is also very valuable in life in general. Take this advice on how attract women and you will surely see a big increase in your chances with them.
Wednesday, November 11, 2009
ألب أرسلان - محطم الإمبراطورية البيزنطية
Tuesday, November 10, 2009
INF: Shrinking the Transaction Log in SQL Server 2000 with DBCC SHRINKFILE
MORE INFORMATION
When DBCC SHRINKFILE is run, SQL Server 2000 shrinks the log file by removing a...
- You must run a BACKUP LOG statement to free up space by removing the inactive portion of the log.
- You must run DBCC SHRINKFILE again with the desired target size until the log file shrinks to the target size.
- Run this code:
NOTE: If the target size is not reached, proceed to the next step.
DBCC SHRINKFILE(pubs_log, 2)
- Run this code if you want to truncate the transaction log and not keep a backup of the transaction log. Truncate_only invalidates your transaction log backup sequence. Take a full backup of your database after you perform backup log with truncate_only:
BACKUP LOG pubs WITH TRUNCATE_ONLY
-or-Run this code if you want to keep a backup of your transaction log and keep your transaction log backup sequence intact. See SQL Server Books Online topic "BACKUP" for more information:
BACKUP LOG pubs TO pubslogbackup
- Run this code:
The transaction log has now been shrunk to the target size.
DBCC SHRINKFILE(pubs_log,2)
REFERENCES
For additional information about shrinking the transaction log in SQL Server 7.0, click the article number below to view the article in the Microsoft Knowledge Base:
Monday, November 09, 2009
INFO: Required Network Rights for the SourceSafe Directories
For SourceSafe 3.x
SourceSafe for Rights Required
Windows NT for
Directory Network Access
--------------- ----------------
\SS\WINNT Read
SourceSafe for Rights Required
MS-DOS or Windows for
Directory Network Access
----------------- --------------------------------------------
\SS Read
\SS\DATA Full access or read-only for read-only users
\SS\ADMIN None - But SourceSafe admins should have
full access
\SS\TEMP Full access
\SS\USERS\ Full access
\SS\WINNT None
\SS\MACROS Read
SourceSafe 4.0 Server Installation
SourceSafe for Rights Required
32-bit Windows for
Directory Network Access
----------------- --------------------------------------
\VSS\WIN32 None-But SourceSafe admins should have
full access
SourceSafe for Rights Required
16-bit Windows for
Directory Network Access
----------------- --------------------------------------
\VSS\WIN None-But SourceSafe admins should have
full access
\VSS\DOS None-But SourceSafe admins should have
full access
SourceSafe for Rights Required
MS-DOS or Windows for
Directory Network Access
------------------ --------------------------------------------
\VSS Read
\VSS\DATA Full access or read-only for read-only users
\VSS\TEMP Full access
\VSS\USERS\ Full access
\VSS\NETSETUP.X86 Read
\VSS\MACROS Read SourceSafe 5.0 Server Installation
SourceSafe for Rights Required
32-bit Windows for
Directory Network Access
----------------- --------------------------------------
\VSS\WIN32 None-But SourceSafe admins should have
full access
SourceSafe for Rights Required
MS-DOS or Windows for
Directory Network Access
----------------- --------------------------------------------
\VSS Read
\VSS\DATA Full access or read-only for read-only users
\VSS\DATA\LOGGEDIN Full access
\VSS\TEMP Full access
\VSS\USERS\ Full access
\VSS\NETSETUP Read SourceSafe 6.0 Server Installation
SourceSafe for Rights Required
32-bit Windows for
Directory Network Access
----------------- --------------------------------------
\VSS\WIN32 None-But SourceSafe admins should have
full access
SourceSafe for Rights Required
MS-DOS or Windows for
Directory Network Access
----------------- --------------------------------------------
\VSS Read
\VSS\DATA Full access or read-only for read-only users
\VSS\DATA\LOGGEDIN Full access
\VSS\DATA\LABELS Full access
\VSS\TEMP Full access
\VSS\USERS\ Full access
\VSS\NETSETUP Read Although not recommended for performance reasons, if your SourceSafe Clients intend to run the SourceSafe executables directly from the Network (that is, they are not going to create a client installation on their local drives), then modify the table above with the following changes:
SourceSafe for Rights Required
32-bit Windows for
Directory Network Access
--------------- --------------------------------------
\VSS\WIN32 Read-But SourceSafe admins should have
full access
SourceSafe for Rights Required
16-bit Windows for
Directory Network Access
---------------- --------------------------------------
\VSS\WIN Read-But SourceSafe admins should have
full access
\VSS\DOS Read-But SourceSafe admins should have
full accessSunday, November 08, 2009
Optimistic Concurrency
| Column name | Original value | Current value | Value in database |
|---|---|---|---|
| CustID | 101 | 101 | 101 |
| LastName | Smith | Smith | Smith |
| FirstName | Bob | Bob | Bob |
| Column name | Original value | Current value | Value in database |
|---|---|---|---|
| CustID | 101 | 101 | 101 |
| LastName | Smith | Smith | Smith |
| FirstName | Bob | Robert | Bob |
| Column name | Original value | Current value | Value in database |
|---|---|---|---|
| CustID | 101 | 101 | 101 |
| LastName | Smith | Smith | Smith |
| FirstName | Bob | James | Robert |
Testing for Optimistic Concurrency Violations
SELECT Col1, Col2, Col3 FROM Table1
UPDATE Table1 Set Col1 = @NewCol1Value,
Set Col2 = @NewCol2Value,
Set Col3 = @NewCol3Value
WHERE Col1 = @OldCol1Value AND
Col2 = @OldCol2Value AND
Col3 = @OldCol3ValueUPDATE Table1 Set Col1 = @NewVal1 WHERE (@OldVal1 IS NULL AND Col1 IS NULL) OR Col1 = @OldVal1
The DataAdapter.RowUpdated Event
Optimistic Concurrency Example
Dim nwindConn As SqlConnection = New SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=northwind") Dim custDA As SqlDataAdapter = New SqlDataAdapter("SELECT CustomerID, CompanyName FROM Customers ORDER BY CustomerID", nwindConn) ' The Update command checks for optimistic concurrency violations in the WHERE clause. custDA.UpdateCommand = New SqlCommand("UPDATE Customers (CustomerID, CompanyName) VALUES(@CustomerID, @CompanyName) " & _ "WHERE CustomerID = @oldCustomerID AND CompanyName = @oldCompanyName", nwindConn) custDA.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.NChar, 5, "CustomerID") custDA.UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar, 30, "CompanyName") ' Pass the original values to the WHERE clause parameters. Dim myParm As SqlParameter myParm = custDA.UpdateCommand.Parameters.Add("@oldCustomerID", SqlDbType.NChar, 5, "CustomerID") myParm.SourceVersion = DataRowVersion.Original myParm = custDA.UpdateCommand.Parameters.Add("@oldCompanyName", SqlDbType.NVarChar, 30, "CompanyName") myParm.SourceVersion = DataRowVersion.Original ' Add the RowUpdated event handler. AddHandler custDA.RowUpdated, New SqlRowUpdatedEventHandler(AddressOf OnRowUpdated) Dim custDS As DataSet = New DataSet() custDA.Fill(custDS, "Customers") ' Modify the DataSet contents. custDA.Update(custDS, "Customers") Dim myRow As DataRow For Each myRow In custDS.Tables("Customers").Rows If myRow.HasErrors Then Console.WriteLine(myRow(0) & vbCrLf & myRow.RowError) Next Private Shared Sub OnRowUpdated(sender As object, args As SqlRowUpdatedEventArgs) If args.RecordsAffected = 0 args.Row.RowError = "Optimistic Concurrency Violation Encountered" args.Status = UpdateStatus.SkipCurrentRow End If End Sub [C#] SqlConnection nwindConn = new SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=northwind"); SqlDataAdapter custDA = new SqlDataAdapter("SELECT CustomerID, CompanyName FROM Customers ORDER BY CustomerID", nwindConn); // The Update command checks for optimistic concurrency violations in the WHERE clause. custDA.UpdateCommand = new SqlCommand("UPDATE Customers (CustomerID, CompanyName) VALUES(@CustomerID, @CompanyName) " + "WHERE CustomerID = @oldCustomerID AND CompanyName = @oldCompanyName", nwindConn); custDA.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.NChar, 5, "CustomerID"); custDA.UpdateCommand.Parameters.Add("@CompanyName", SqlDbType.NVarChar, 30, "CompanyName"); // Pass the original values to the WHERE clause parameters. SqlParameter myParm; myParm = custDA.UpdateCommand.Parameters.Add("@oldCustomerID", SqlDbType.NChar, 5, "CustomerID"); myParm.SourceVersion = DataRowVersion.Original; myParm = custDA.UpdateCommand.Parameters.Add("@oldCompanyName", SqlDbType.NVarChar, 30, "CompanyName"); myParm.SourceVersion = DataRowVersion.Original; // Add the RowUpdated event handler. custDA.RowUpdated += new SqlRowUpdatedEventHandler(OnRowUpdated); DataSet custDS = new DataSet(); custDA.Fill(custDS, "Customers"); // Modify the DataSet contents. custDA.Update(custDS, "Customers"); foreach (DataRow myRow in custDS.Tables["Customers"].Rows) { if (myRow.HasErrors) Console.WriteLine(myRow[0] + "\n" + myRow.RowError); } protected static void OnRowUpdated(object sender, SqlRowUpdatedEventArgs args) { if (args.RecordsAffected == 0) { args.Row.RowError = "Optimistic Concurrency Violation Encountered"; args.Status = UpdateStatus.SkipCurrentRow; } }
Categories
- Programing (5)
- إسلاميات (3)
- اقتصاد (2)
- الإعجاز العلمي (1)
- تنمية بشرية (16)
- معلومات عامة (1)