扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:电子技术 2007年10月14日
关键字: VB SQL Server 数据库
在本页阅读全文(共3页)
Dim mydb As Database Dim mydynaset As Dynaset オ Private Sub Form_Load() Set mydb = OpenDatabase("", False, False, "ODBC; DSN=Myserver; WSID=LCL; DATABASE = sales") Set mydynaset = mydb CreateDynaset("Select*from Customers") オ End Sub |
Global giHEnv As Long Global giHDB As Long Global giHStmt As Long Dim myResult As integer Dim myConnection As Srting Dim myBuff As String*256 Dim myBufflen As Integer If SQLAllocEnv(giHEnv)<>SQL_SUCCESS Then MsgBox"Allocation couldn注释:t happen!" End If If SQLAllocConnect(giHEnv,giHDB)<>SQL_SUCCESS Then MsgBox "SQL Server couldn注释:t connect!" End If myConnection="DSN=myServer;UID=LCL;PWD=;APP=ODBCTest;WSID=LCL;DATABASE=sales" myResult=SQLDriverConnect(giHDB,Test,form1.hWnd,myConnection.len(myConnection), myBuff,256,myBufflen,SQL_DRIVER_COMPLETE_REQU IE D) myResult=SQLAllocStmt(giHDS,giHStmt) myResult=SQLFreeStmt(giHStmt,SQL_COLSE) rsSQL="Select * from Customers Where City = "Hunan"" myResult = SQLExecDirect(giHStmt,rsSQL,Len(rsSQL)) |
Private Sub InitializeApplication() DBLIB_VERSION=SqlInit() If DBLIB_VERSION=""Then MsgBox"Could not initialize DBLIB!Exit application.", MB_ICONEXCLAMATION End If End Sub Private Function LoginToServer() As integer loginToServer=SUCCEED Status%=SqlSetloginTime%(loginTimeOut) If giSqlConn<>0 Then SqlClose(giSqlConn) 注释:关闭已打开的连接 giSqlConn=SqlOpenConnection(gsServerName, gsLoginID, gsPassword, ProgramName, ProgramName) If giSqlConn<>0 Then liresuit=SqlUse(giSqlConn,"Sales") Else LogintoServer=FAIL End If End Function |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者