adodb

“Not enough storage is available to complete this operation” when base64-encoding a zip file

喜你入骨 提交于 2019-12-18 05:09:37
问题 The below code is for converting a zip file to base64 format. Dim inByteArray, base64Encoded, Const TypeBinary = 1 inByteArray = readBytes("F:path/file.zip") base64Encoded = encodeBase64(inByteArray) Private Function readBytes(file) Dim inStream ' ADODB stream object used Set inStream = CreateObject("ADODB.Stream") ' open with no arguments makes the stream an empty container inStream.Open inStream.Type = TypeBinary inStream.LoadFromFile(file) readBytes = inStream.Read() End Function Private

VBA - Create ADODB.Recordset from the contents of a spreadsheet

前提是你 提交于 2019-12-18 04:20:57
问题 I am working on an Excel application that queries a SQL database. The queries can take a long time to run (20-40 min). If I've miss-coded something it can take a long time to error or reach a break point. I can save the results to a sheet fine, it's when I am working with the record sets that things can blow up. Is there a way to load the data into a ADODB.Recordset when I'm debugging to skip querying the database (after the first time)? Would I use something like this? Query Excel worksheet

ADODB Connection String: Workgroup Information file is Missing?

别等时光非礼了梦想. 提交于 2019-12-18 04:17:27
问题 I have a few data sources in access that I need to connect to programatically to do things with behind the scenes and keep visibility away from users. Said datasource has a password 'pass' as I'm going to call it here. Using this connection method I get an error attempting to use the open method Dim conn as ADODB.Connection Set ROBBERS.conn = New ADODB.Connection conn.open "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=\\pep-home\projects\billing\autobilling\DPBilling2.mdb;" _ & "Jet

VBA New Database Connection

╄→гoц情女王★ 提交于 2019-12-17 18:32:17
问题 How to change the code below to prevent what you see in the screenshot. I am running a macro with the following code Dim conn As ADODB.Connection Dim rec1 As ADODB.Recordset Dim thisSql As String Set conn = New ADODB.Connection Dim sConn As String sConn = "Provider=SQLOLEDB;Trusted_Connection=Yes;Server=xyz;Database=xyz;UID=xyz;PWD=xyz" conn.Open sConn ' this is creating multiple connections. Set rec1 = New ADODB.Recordset rec1.Open thisSql, conn which runs a SQL Server query (which is around

Deep Copy or Clone an ADODB recordset in VBA

邮差的信 提交于 2019-12-17 15:57:18
问题 I have been searching for a way of duplicating or copying a recordset in VBA. And by that I mean, having the undelying data independent of each other. I have tried Set copyRS = origRS.Clone Set copyRS = origRS When I use any of the methods I cant modify one recordset without modifying the other. So in this example: I create a recordset I populate the recordset with the name John I clone the recordset I modify the cloned one Check result Code: Dim origRS As Recordset, copyRS As Recordset Set

Unable to read data from a CSV using ADO due to the driver thinking I am working with integers/number and showing nulls instead of text

浪子不回头ぞ 提交于 2019-12-17 14:23:31
问题 I am trying to use the ADO to read in a series of text files into a worksheet. I am running into problems when the majority of the data in a specific column are integers. It will give null values (blank cells) when it reaches a String. According to microsoft support (Ado mixed data tyes) this is a common thing and the solution is to set the IMEX = 1 . I tried this however it didn't work. I have been searching others threads looking for the answer and came across this answer (other thread)

Unable to read data from a CSV using ADO due to the driver thinking I am working with integers/number and showing nulls instead of text

[亡魂溺海] 提交于 2019-12-17 14:22:28
问题 I am trying to use the ADO to read in a series of text files into a worksheet. I am running into problems when the majority of the data in a specific column are integers. It will give null values (blank cells) when it reaches a String. According to microsoft support (Ado mixed data tyes) this is a common thing and the solution is to set the IMEX = 1 . I tried this however it didn't work. I have been searching others threads looking for the answer and came across this answer (other thread)

Error trying to call stored procedure with prepared statement

扶醉桌前 提交于 2019-12-17 10:14:08
问题 I'm trying to use a prepared statement to call a stored procedure (using ADODB with classic ASP), but when I set CommandType I get the following error: ADODB.Command error '800a0bb9' Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another. I have the following code: With Server.CreateObject("ADODB.Command") .ActiveConnection = db 'this is initialized prior .CommandType = adCmdStoredProc .CommandText = "procName" End With The prepared statement name is

How do I run a VBScript in 32-bit mode on a 64-bit machine?

陌路散爱 提交于 2019-12-17 04:18:51
问题 I have a text file that ends with .vbs that I have written the following in: Set Conn = CreateObject("ADODB.Connection") Conn.Provider = "Microsoft.ACE.OLEDB.12.0" Conn.Properties("Data Source") = "C:\dummy.accdb" Conn.Properties("Jet OLEDB:Database Password") = "pass" Conn.Open Conn.Close Set Conn = Nothing When I execute this on a Windows 32-bit machine it runs and ends without any notion (expected). When I execute this on a Windows 64-bit machine it gets the error Provider cannot be found.

Xl Add-In (VBA) and persistent objects

假如想象 提交于 2019-12-14 04:08:56
问题 I am writing an add-in for XL 2010 / 2013 that makes use of a database connection via an ADODB.Connection object. I tried to declare the object in various ways in order for it to remain between uses of the add-in but so far to no avail. The goal is to initialise the connection at startup and maintain this for the duration. When the add-in workbook's Open event is triggered the initialisation code runs fine, makes the connection and I have an ADODB.Connection object. When the sequence finishes