Creating SQL Server Objects with ActiveX Data Objects
Số trang: 2
Loại file: pdf
Dung lượng: 8.84 KB
Lượt xem: 4
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Tạo SQL Server Đối tượng với ActiveX Data Objects Đó là giá trị phải đề cập đến một ví dụ của việc tạo ra một đối tượng bảng mới với các lĩnh vực và khóa chính quy định, mặc dù phần lớn các công việc của việc tạo ra các đối tượng sử dụng ADO và SQL Server được thực hiện trong T-SQL Báo cáo mà bạn tạo
Nội dung trích xuất từ tài liệu:
Creating SQL Server Objects with ActiveX Data Objects Creating SQL Server Objects with ActiveX Data ObjectsIt is worthwhile to mention an example of creating a new table object with fields andprimary key specified, even though the majority of the work of creating objects usingADO and SQL Server is done in the T-SQL Statement that you create. You will executethis statement using the Command object, as shown in Listing A.10.Listing A.10 basStoredProcedureExamples.vb: Creating SQL Server Objects withADO and T-SQLSub CreatingASQLServerObjectFromADO(ByVal txtResults As TextBox) Dim cnn As New ADODB.Connection() Dim cmd As New ADODB.Command() Dim prm As ADODB.Parameter Dim rstOld As New ADODB.Recordset() Dim rstNew As New ADODB.Recordset() -- In .NET, we can assign values as we declare variables. This is where the hard work is. Dim strSQL As String = CREATE TABLE Test (PrimaryIntFld Integer IDENTITY(1,1) PRIMARY KEY, Field2 Text) -- Open the connection OpenNorthwindADOConnection(cnn) -- Set up the Command object to use the SQL string. cmd.ActiveConnection = cnn cmd.CommandText = strSQL cmd.CommandType = ADODB.CommandTypeEnum.adCmdText -- Execute the command cmd.Execute()End SubThis routine is a lot like the previous example except for the SQL statement and the factthat results arent displayed. You can see the results by going to the Visual Studio .NETServer Explorer, zeroing in on the tables for the Northwind database, and opening thenew Test table in Design mode, as shown in Figure A.7. Figure A.7. Creating objects such as this table is just a matter of learning the correct SQL syntax.Note If you already had the tables displayed for Northwind, you might need to right-click on the Tables node and choose Refresh.
Nội dung trích xuất từ tài liệu:
Creating SQL Server Objects with ActiveX Data Objects Creating SQL Server Objects with ActiveX Data ObjectsIt is worthwhile to mention an example of creating a new table object with fields andprimary key specified, even though the majority of the work of creating objects usingADO and SQL Server is done in the T-SQL Statement that you create. You will executethis statement using the Command object, as shown in Listing A.10.Listing A.10 basStoredProcedureExamples.vb: Creating SQL Server Objects withADO and T-SQLSub CreatingASQLServerObjectFromADO(ByVal txtResults As TextBox) Dim cnn As New ADODB.Connection() Dim cmd As New ADODB.Command() Dim prm As ADODB.Parameter Dim rstOld As New ADODB.Recordset() Dim rstNew As New ADODB.Recordset() -- In .NET, we can assign values as we declare variables. This is where the hard work is. Dim strSQL As String = CREATE TABLE Test (PrimaryIntFld Integer IDENTITY(1,1) PRIMARY KEY, Field2 Text) -- Open the connection OpenNorthwindADOConnection(cnn) -- Set up the Command object to use the SQL string. cmd.ActiveConnection = cnn cmd.CommandText = strSQL cmd.CommandType = ADODB.CommandTypeEnum.adCmdText -- Execute the command cmd.Execute()End SubThis routine is a lot like the previous example except for the SQL statement and the factthat results arent displayed. You can see the results by going to the Visual Studio .NETServer Explorer, zeroing in on the tables for the Northwind database, and opening thenew Test table in Design mode, as shown in Figure A.7. Figure A.7. Creating objects such as this table is just a matter of learning the correct SQL syntax.Note If you already had the tables displayed for Northwind, you might need to right-click on the Tables node and choose Refresh.
Tìm kiếm theo từ khóa liên quan:
công nghệ máy tính phần mềm kỹ thuật lập trình lập trình dữ liệu ActiveX Data ObjectsGợi ý tài liệu liên quan:
-
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 265 0 0 -
NGÂN HÀNG CÂU HỎI TRẮC NGHIỆM THIẾT KẾ WEB
8 trang 206 0 0 -
Giới thiệu môn học Ngôn ngữ lập trình C++
5 trang 194 0 0 -
6 trang 191 0 0
-
Bài giảng Nhập môn về lập trình - Chương 1: Giới thiệu về máy tính và lập trình
30 trang 166 0 0 -
Luận văn: Nghiên cứu kỹ thuật giấu tin trong ảnh Gif
33 trang 153 0 0 -
Báo cáo thực tập Công nghệ thông tin: Lập trình game trên Unity
27 trang 118 0 0 -
Giáo trình về phân tích thiết kế hệ thống thông tin
113 trang 114 0 0 -
LUẬN VĂN: Tìm hiểu kỹ thuật tạo bóng cứng trong đồ họa 3D
41 trang 108 0 0 -
Bài giảng Kỹ thuật lập trình - Chương 10: Tổng kết môn học (Trường Đại học Bách khoa Hà Nội)
67 trang 106 0 0