adodb

ADODB SQL Syntax - Access table Inner Join with Excel worksheet

匆匆过客 提交于 2021-02-19 02:36:09
问题 I have a project where users will need to fill out an Excel file and then export the data to an Access database. The data collected in the Excel file will need to be exported in 3 steps: (1) export data set 1 record, (2) query Access for the primary key (auto-number) of the newly imported record, (3) export data set 2 record, which includes the primary key populated as the foreign key. I am able to accomplish the first step by establishing and opening an ADODB connection. However, I am

excel VBA动态链接数据库

微笑、不失礼 提交于 2021-02-15 21:05:04
最近车间制造部有需求,需要通过excel填写的ID获取数据库中的某个取值。研究了一下VBA,简要记录一下代码,仅供参考。 Function GETPMAX(SID As String) As String Dim result As String ' 链接数据库 Set Cnn = CreateObject( " ADODB.Connection " ) Set rt = CreateObject( " ADODB.Recordset " ) Cnn.ConnectionString = " Provider = SQLOLEDB;User ID= ;password=;Data Source=;Initial Catalog = " Cnn.Open Sql = " SELECT TOP 1 Pmax FROM dbo where ID=' " & SID & " ' order by hDateTime desc " ' 获取记录集 Set rt = Cnn.Execute(Sql) ' 根据字段获取值 result = CStr(rt( " Pmax " )) GETPMAX = result ' 关闭记录集 rt.Close ' 关闭数据库链接,释放资源 Cnn.Close End Function 来源: oschina 链接: https://my.oschina

adodb execute sql command timeout

无人久伴 提交于 2021-02-11 17:27:27
问题 I have this code below and it is hanging on me. It worked fine for several files...but it is now hanging on me and times out with error (-2147217871:Query timeout expired). 'This is what it looks like in SQL Server when I print the string in the immediate window: BEGIN TRAN; INSERT INTO [dbo].[XLSHdr] WITH(TABLOCK) ([HdrID],[TabName],[FileHyperLink],[FileName],[DocumentType],[EmailID],[Subject],[SentDate],[AttachmentName],[TextFileLink],[DateReceived],[Vendor],[ContactName],[ContactNumber],

Query MySQL Table with Excel VBA, ODBC Connection

旧巷老猫 提交于 2021-02-10 15:52:01
问题 I've got a bit of an issue with Microsoft Excel while trying to get values from an MySQL 8.0 Table. I have some code (below) I got from the net but I keep getting an error message. I'm quite new at this so I need a bit of help. I'm on Windows 10 with a 64 bit computer. Timeline: → I downloaded MySQL a week ago, got the 8.0 workbench version and have the connector installed (Connector/ODBC 8.0.12 - X64). → I created a Schema called sap in the MySQL Workbench → I created a Table in sap called

为什么选择PHP作为后台语言

℡╲_俬逩灬. 提交于 2021-02-10 11:23:00
越来越多的企业使用PHP+MYSQL搭建网站,究竟PHP有什么好,为什么要选择用PHP? 1. 跨平台,性能优越,跟Linux/Unix结合别跟Windows结合性能强45%,并且和很多免费的平台结合非常省钱,比如LAMP (Linux/Apache/Mysql/PHP)或者FAMP(FreeBSD/Apache/Mysql/PHP)结合,或者数据应用够大可以考虑换 PostgreSQL或者Oracle,支持N种数据库。(N >= 10) 2. 语法简单,如果有学习C和Perl的很容易上手,并且跟ASP有部分类似。有成熟的开发工具,比如NuPHPed,或者Zend Studio等等,再Linux平台下可以使用Eclipse等等。 3. 目前主流技术都支持,比如WebService、Ajax、XML等等,足够应用。 4. 有比较完整的支持,比如使用ADODB或者PEAR::DB做数据库抽象层,用Smarty或者smart template做模板层,如果是PHP 5.1的话,还能够使用PDO(PHP Data Object)来访问数据库。 5. 有很成熟的框架,比支持MVC的框架:phpMVC,支持类似ASP.net的事件驱动的框架:Prado,支持类似Ruby On Rails的快速开发的框架:Cake等等,足够满足你的应用需求。 PHP 6. PHP 5已经有成熟的面向对象体系

How to import a csv file using @ as delimiter with VBA

旧巷老猫 提交于 2021-02-07 07:15:50
问题 I am trying to load data from a csv file in Excel with VBA using ADODB. I have a function to return a Connection object. Private Function OpenConnection(dataSource As String) As ADODB.Connection Set OpenConnection = CreateObject("ADODB.Connection") With OpenConnection .ConnectionTimeout = 5 .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dataSource & ";" & _ "Extended Properties=""Text;HDR=YES;FMT=Delimited(,)"";Persist Security Info=False" Debug.Print "trying to connect

Working with ADODB recordset

随声附和 提交于 2021-01-28 11:51:07
问题 I am using VS 2010. The requirement to pull the ADODB recordset and convert them into DataTable . Is there any extension method or library available in ASP.NET to convert ADODB recordset to Datatable. I can understand using OleDataAdapter we can achieve it. But I am curious to know is there any utility available in ASP.net so that I can make use of it. 回答1: This is one of the simple approaches which helps you to convert ADODB Recordset to DataTable . public static DataTable

ADODB not passing in parameters

给你一囗甜甜゛ 提交于 2021-01-27 18:54:10
问题 I have a SQL SP with the following parameters... myProc(@param1 AS TINYINT, @sparam2 AS TINYINT, @param3 AS TINYINT, @param4 AS TINYINT, @param5 AS TINYINT, @param6 AS TINYINT, @param7 AS TINYINT, @paramOut NVARCHAR (255) OUTPUT) and I have the following ADODB code in VBA... sVal1 = 1 sVal2 = 1 sVal3 = 1 sVal4 = 1 sVal5 = 1 sVal6 = 1 sVal7 = 1 Dim cnn As ADODB.Connection Dim cmd As ADODB.Command Dim param1, param2, param3, param4, param5, param6, param7, param8 As ADODB.Parameter Dim Rs As

【VBA研究】Excel连接Oracle的一些说明

谁说胖子不能爱 提交于 2021-01-08 10:47:27
作者: iamlaosong 通过VBA连接Oracle数据库查询数据,一般有两种OleDB连接驱动方法,一种是用微软的驱动,另一种用Oracle驱动,Provider需要根据实际情况修改。这儿对我使用的环境做个记录。 1、Microsoft公司提供的OleDB驱动MSDAORA,据说只支持32位系统,我在32位系统下使用没有问题,其连接字符串如下: connectionString="Provider=MSDAORA;Data Source=dataSource;User Id=userid;Password=password;" 或 connectionString="Provider=MSDAORA.1;Data Source=dataSource;User Id=userid;Password=password;" 其中MSDAORA.1是驱动的名称,“.1”据说是版本号,是COM的命名规则的一个约定格式,可以不写;dataSource是Oracle客户端配置的服务名,就是tnsnames.ora中配置的名称。 驱动程序msdaora.dll放在C:\Program Files\Common Files\System\Ole DB文件夹下面。 实际例子: Set cnn = CreateObject("ADODB.Connection") Set rst =

Excel VBA MySql parameterised update 'invalid parameter type'

一笑奈何 提交于 2021-01-04 12:27:56
问题 I am creating an interface where users can use excel to seamlessly alter an SQL database. I can retrieve data fine however when updating records I get an 'invalid parameter type'. It works fine with just concatenating values into the query, however to prevent SQL injections I require a parameterised query. I have tried substituting in the ADO datatype with the value however this has not changed anything. I have tried unnamed parameters which just always submits a value of 16 to the database