WEB开发网
开发学院数据库MSSQL Server ODBC API常用函数诠释 阅读

ODBC API常用函数诠释

 2008-09-03 10:01:06 来源:WEB开发网   
核心提示: function integer SQLError(long lenv,long hdbc,long hstmt,ref string sqlstate,ref long nativeerror,ref string errormsg,integer errormsgmax,ref int

function integer SQLError(long lenv,long hdbc,long hstmt,ref string sqlstate,ref long nativeerror,ref string errormsg,integer errormsgmax,ref integer errormsglen)library "odbc32.dll"

function integer SQLFreeStmt(long hstmt,integer Options)library "odbc32.dll"

声明一个函数wf_sqlerror()

代码如下:

   stringls_sqlstate,ls_errormsg
  integerli_errormsgmax,li_ret
  longnativeerror
  ls_errormsg=space(255)
  ls_sqlstate=space(255)
  li_ret=sqlerror(henv,hdbc,hstmt,ls_sqlstate,li_nativeerror,ls_errormsg,255,li_errormsgmax)
  messagebox("ODBC:"+ls_sqlstate,ls_errormsg)
  return

窗口的open 事件,写入如下代码:

   stringls_dsn,ls_description
  integerli_direction,li_dsnmax,li_dsn_len
  integerli_descriptionmax,li_description_len,li_retval
  ls_dsn=space(255)
  li_dsnmax=len(li_dsn)
  ls_description=space(255)
  li_descriptionmax=len(ls_description)
  ifsqlallocenv(henv)=-1then
  wf_sqlerror()
  else
  li_driection=1
  dowhilesqldatasources(henv,li_direction,ls_dsn,li_dsnmax,li_dsn_len,ls_description,li_descriptionmax,li_description_len)=0
  lb_datasources.additem(ls_dsn0
  loop
  endif

窗口的close事件中写入如下代码:

   sqldisconnect(hdbc)
  sqlfreeenv(henv)

上一页  2 3 4 5 6 7 8 9  下一页

Tags:ODBC API 常用

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接