TAILIEUCHUNG - Buit Windows By C.Net (Phần 4) part 7

Tham khảo tài liệu 'buit windows by (phần 4) part 7', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 458 PHẤN IV Kỹ thuật Web 8 9 public class DBAccess 10 11 12 sumrtiary 13 III Get an active connection to the stingray database 14 summary 15 public static SqlConnection AquireConnection 16 SqlConnection dbCon 17 new SqlConnectionf 18 user id sa passwords initial catalog stingray data source . Connect Timeout 30 19 20 try 21 22 catch Exception 23 24 dbCon null 25 26 27 return dbCon 28 .29 30 31 summary 32 Save a DBEntity into the stingray Database 33 summary 34 param name ActiveConnection Active Database Connection param 35 III param name entity The Entity to be saved param b CHƯƠNG 4-2 Truy xuất dữ liệu trên .NET 459 36 public static bool Save SqlConnection ActiveConnection DBEntity entity 37 38 Is there anyting to save 39 if 40 return true 41 42 object Attributes .GetCustomAttributes 43 typeof 44 false 45 46 47 if 1 1 48 return false 49 50 System. Data. ADO. SqlClient. SqlCommand Sqlcmd new SqlCommand 51 ActiveConnectlon 52 53 54 55 Do we insert or Update 56 57 DBTableAttribute TableAttribute DBTableAttribute Attributes 0 58 59 if entity. IsNew 60 61 else 62 PHẦN IV Kỹ thuật Web 460 63 64 65 AddCmdParam Sqlcmd entity 66 67 try 68 69 ỉ 70 return true 71 72 catchf Exception 73 Do something for Heavens sake 74 75 76 Should not make it to here unless it go BOOM 77 return false 78 79 80 auiranary 81 Create the ADOParameter s for the DBEnity objed 82 summary 83 param name cmd The SqlCommand object to add the Prameters to param 84 param name- entity The DBEnity to scrape param 85 protected static void AddCmdParamt SqlCommand cmd DBEntity entity 86 87 88 Get the Public properties and create the SQL Parameters 89 90 Type T entity. GetType 91 Propertyinfo Properties

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.