ODBC API常用函数诠释
2008-09-03 10:01:06 来源:WEB开发网在cb_connect按钮的cliked事件中写入如下的代码:
integerli_ret
stringls_dsn,ls_uid,ls_pwd
stringls_qualifer,ls_owner,ls_name,ls_type,ls_table
longll_len
ls_dsn=lb_datasources.selecteditem()
ls_uid=sle_uid.text
ls_pwd=sle_pwd.text
li_ret=sqlallocconnect(henv,hdbc)
ifli_ret<0then
wf_sqlerror()
else
li_ret=sqlconnect(hdbc,ls_dsn,len(ls_dsn),ls_uid,len(ls_uid),ls_pwd,len(ls_pwd))
ifli_ret<0then
wf_sqlerror()
else
li_ret=sqlallocstmt(hdbc,hstmt)
ifli_ret<0then
wf_sqlerror()
else
ls_type="’TABLE’,’VIEW’"
ifcbx_systemtables.checkedthen
ls_type=ls_type+",’SYSTEMTABLE’"
endif
li_ret=SQLTABLES(hstmt,ls_qualifier,len(ls_qualifier),ls_owner,len(ls_owner),ls_name,len(ls_name),ls_type,len(ls_type))
ifli_ret<0then
wf_sqlerror()
else
ls_table=space(255)
ll_len=255
sqlbincol(hstmt,3,1,ls_table,ll_len,ll_en)
lb_tables.setredraw(false)
dowhilesqlfetch(hstmt)=0
lb_tables.additem(ls_table)
loop
lb_tables.setredraw(true)
li_ret=sqlfreestmt(hstmt,0)
endif
endif
endif
endif
this.enabled=false
this.default=false
cbx_systemtables.enabled=false
更多精彩
赞助商链接