tailieunhanh - Pro .NET 2.0 Extreme Programming 2006 phần 7

Tham khảo tài liệu 'pro .net extreme programming 2006 phần 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ả | CHAPTER 13 FIRST ITERATION 185 Build connection string connectionstring new StringBuilder Driver Microsoft Access Driver .mdb DBQ c xpnet database SetUp public void Init try OdbcConnection dataConnection new OdbcConnection OdbcCommand dataCommand new OdbcCommand dataConnection Build command string StringBuilder commandText new StringBuilder INSERT INTO Products ProductName CategoryID UnitPrice UnitsInStock VALUES productName categoryID price quantity int rows Make sure that the INSERT worked 1 rows Unexpected row count gasp Get the ID of the category we just inserted This will be used to remove the category in the TearDown commandText new StringBuilder SELECT ProductID FROM Products WHERE ProductName Bogus Product 186 CHAPTER 13 FIRST ITERATION OdbcDataReader dataReader Make sure that we found our product if productID 0 catch Exception e Error TearDown public void Destroy try OdbcConnection dataConnection new OdbcConnection OdbcCommand dataCommand new OdbcCommand dataConnection Build command string StringBuilder commandText new StringBuilder DELETE FROM Products WHERE ProductID productID int rows Make sure that the DELETE worked 1 rows Unexpected row count gasp .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
54    153    1    28-12-2024