[求助]请问怎么用ODBC连接数据库????
我使用的是VB+SQL2000,现在出现了一个连接问题,请问怎么用ODBC连接数据库???越详细越好,谢谢了~~~~~~
Dim myResult As integer?
Dim myConnection As Srting?
Dim myBuff As String*256
Dim myBufflen As Integer?
If SQLA||ocEnv(giHEnv)<>SQL_SUCCESS Then
MsgBox"A||ocation couldn't happen!"
End if
if SQL||ocConnect(giHEnv,giHDB)<>SQL_SUCCESS Then
MsgBox "SQL Server couldn't connect!"
End if
myConnection="DSN=.;UID=|c|;PWD=;APP=ODBCTest;WS|D=LCL;DATABASE=sales"
myResult=SQLDriverConnect(giHDB,Test,form1.hWnd,myConnection.len(myConnection),
myBuff,256,myBufflen,SQL_DRIVER_COMPLETE_REQUIED)
myResult=SQLA||ocStmt(giHDS,giHStmt)
myResult=SQLFreeStmt(giHStmt,SQL_COLSE)
rsSQL="SQL语句"
myResult=SQLExecDirect(giHStmt,rsSQL,Len(rsSQL))