TAILIEUCHUNG - Giáo trình lý thuyết và thực hành Orale part 9

Tham khảo tài liệu 'giáo trình lý thuyết và thực hành orale part 9', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 706 Chường 23__ỨNG DỤNG ODBC ByVai hstmt As Long Dim iError As Integer Dim szSQLState As string 10 Dim iNativeError As Long Dim szErrorMsg As string 511 Dim ỈMsgLength As Integer Dim szODBCMsg As String iError SQLError hEnv hDBc hstmt szSQLState iNativeError szErrorMsg SQL_MAX_MESSAGE_LENGTH 1 iMsgLength If iError 0 Then szODBCMsg Left szErrorMsg iMsgLength Beep MsgBox ODBC Error szODBCMsg Else Beep MegBox Undetermined ODBC Error End If End Sub . Gọi các stored Procedures và Functions lĩỗ các Stored Procedure và Functions là một đặc điểm ciia các hệ Quan trị CSDL cao cấp. Ta xét các ví dụ gọi thực hiện các Stored Procedure và Functions bằng c và Visual Basic như sau Ví dụ 23-09 ílàm c gụi Oracle Stored Procedure ở dạng tiền thực thi ỉnt InsertCompanySP HENV hEnv HDBC hDBc COMPANY Companies int iNumCompanỉes _ RETCODE iError int í ỉ HSTMT hstmt iError SQLAllocStmt hĐBc hStmt if iError SQLJ3UCCESS ỈError SQLPrepare hstmt call sp_insert_company 0 SQL_NTS if iError SQL_SUCCESS for ỉ 0 i iNumCompanies I SQLSetParamfhStmt 1 SQL CCHAR SQLCHAR strlen Companies 1 -Company 0 Chưởng 23__ỨNG DỤNG ODBC_707 Companies i .Company NULL -SQLSetParam hStmt 2 SQL_C_CHAR SQL_C_CHAR strlen Companies i .Notes 0 Companies NULL iError SQLExecute hstmt if iError SQL SUCCESS break iError SQLFreeStmt hStmt SQL_ DROP return iError Ví dự 23-10 Hàm Visual Basic gọi stored Procedure bằng thực thi trực tiếp Function InsertCompanySP ByValhEnvAs Long ByVal hDBc As Long Companies As Company ByVal iNumCompanỉes As Integer As Integer Dim iError As Integer Dim iTemp As Integer Dim i As Integer Dim hstmt As Long Dim szSQL As String Dim szCompany As string Dim szNotes As string iError SQLAllocStmt hDBc hstmt If iError SQL_SUCCESS Then For i 0 To iNumCompanies 1 szSQL CALL sp_insert_company szSQL szSQL Companies i .Company szSQL szSQL Companies i .Notes iError SQLExecDirect hstmt szSQL SQL_NTS If iError SQL SUCCESS Then Call ODBCError hEnv

TÀI LIỆU MỚI ĐĂNG
Đã 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.