动态生成dsn的例子,帮我看看问题出在哪?
'''动态生成dsn'''''''''''''''''''''
''''''''''''''''''''''''''''''''''
Public Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" (ByVal hwndParent As Long, ByVal fRequest As Long _
, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Long
Public Const ODBC_ADD_DSN = 1 ' Add data source
Public Const ODBC_CONFIG_DSN = 2 ' Configure (edit) data source
Public Const ODBC_REMOVE_DSN = 3 ' Remove data source
Public Const vbAPINull As Long = 0 ' NULL Pointer
Public Const STR_DSN_IMPORT As String = "llz"
Public Function AddImportDSN(ByVal strPath As String) As Long
Dim intRet As Long
Dim strDriver As String
Dim strAttributes As String
'Set the driver to SQL Server because it is most common.
strDriver = "Microsoft Visual FoxPro Driver"
'Set the attributes delimited by null.
'See driver documentation for a complete
'list of supported attributes.
strAttributes = ""
strAttributes = strAttributes & "DSN=" + STR_DSN_IMPORT + Chr(0)
strAttributes = strAttributes & "UID=" & Chr(0)
strAttributes = strAttributes & "Deleted = Yes" & Chr(0)
strAttributes = strAttributes & "Null=Yes" & Chr(0)
strAttributes = strAttributes & "Collate = Machine" & Chr(0)
strAttributes = strAttributes & "BackgroundFetch = Yes" & Chr(0)
strAttributes = strAttributes & "Exclusive = No" & Chr(0)
strAttributes = strAttributes & "SourceType = DBF" & Chr(0)
strAttributes = strAttributes & "SourceDB=" & strPath & Chr(0)
'To show dialog, use Form1.Hwnd instead of vbAPINull.
SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, strDriver, strAttributes)
'intRet =
'AddImportDSN = intRet
End Function
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
AddImportDSN("c:\mm")
End Sub
SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, strDriver, strAttributes)
报错!未将对象引用设置到对象的实例。
请帮我看看,问题出在哪呢?
相关推荐
ngShoppingExample:angularJS 中的购物车示例
Angular 购物车示例 从 angular-seed 项目创建,因此以下大部分内容适用: 我们还使用了许多 node.js 工具来初始化和测试 angular-seed。 您必须安装 node.js 及其包管理器 (npm)。 您可以从获取它们。 安装依赖 我们在这个项目中有两种依赖:工具和 angular 框架代码。 这些工具帮助我们管理和测试应用程序。 我们通过npm (获得我们依赖的工具。 我们通过bower获取角度代码。 我们已经预先配置了npm来自动运行bower所以我们可以简单地做: npm install 在幕后这也将调用bower install 。 您应该会发现您的项目中有两个新文件夹。 node_modules - 包含我们需要的工具的 npm 包 app/bower_components - 包含 angular 框架文件 请注意, bower_co
2026安卓开发从零实战指南:环境搭建、核心基础与避坑干货(适配新版Android_Studio).pdf
2026安卓开发从零实战指南:环境搭建、核心基础与避坑干货(适配新版Android_Studio).pdf
如何实现科研成果转化率的有效提升与技术市场精准对接?.docx
如何实现科研成果转化率的有效提升与技术市场精准对接?
基于PID控制的ABS汽车防抱死制动系统、车轮滑移率+最优滑移率Carsim和Simulink联合仿真(带参考文献)
内容概要:本文档系统研究了基于PID控制的ABS汽车防抱死制动系统,聚焦于车轮滑移率与最优滑移率的动态控制问题,采用Carsim与Simulink联合仿真平台构建高精度车辆动力学模型与控制系统。研究详细阐述了ABS的工作机理,通过设计PID控制器实时调节制动压力,确保车轮滑移率稳定在最优区间,从而最大化轮胎与路面间的摩擦力,提升制动效能与行车安全性。文档涵盖了完整的建模流程、控制策略设计、仿真验证方法及参数整定过程,并提供了详实的参考文献支持,增强了研究的可复现性与工程应用价值。; 适合人群:具备车辆工程、自动化或控制理论等相关专业背景,熟悉MATLAB/Simulink与Carsim仿真环境的研究生、科研人员及汽车行业技术研发工程师。; 使用场景及目标:①用于ABS控制算法的教学讲解与科研实验;②支撑车辆制动性能优化、主动安全系统开发等实际工程应用;③为相关学术论文撰写、课题复现与技术创新提供理论依据与技术参考。; 阅读建议:建议读者结合所提供的仿真模型与参考文献,逐步运行并调试代码,重点关注滑移率计算逻辑、PID参数整定方法及联合仿真的数据交互机制,同时可尝试引入模糊控制、自适应控制等先进算法进行对比分析,以深入掌握ABS系统的控制精髓与优化路径。
高校如何利用技术转移数据分析优化成果转化路径?.docx
科易网基于40亿+科创知识图谱数据库,深度探索AI技术在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,研究科技创新领域的AI+数智化解决方案,推动科技创新与产业创新智能化发展。


