adodb

How to retrieve data from Excel with ADODB connection if the first line of the worksheet does not have the column name?

☆樱花仙子☆ 提交于 2019-11-28 04:44:40
问题 I use the following type of code to retrieve data from some Excel Workbooks (path is a Parameter) Dim strSQL As String, conStr as String Dim cnn As New ADODB.Connection Dim rs As New ADODB.Recordset conStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & path & "';" & _ "Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;"";" strSQL = "SELECT [Field1], [Field2] FROM [Worksheet$] WHERE [Thing1] > 1" cnn.open conStr rs.Open query, cnn, adOpenStatic, adLockOptimistic, adCmdText That code works

How to set “Application Name” in ADODB connection string

人走茶凉 提交于 2019-11-28 03:34:30
问题 In .NET I simply use Application Name = MyApp inside the connection string, but when using ADO connection through VBA the Activity Monitor of the SQL Server Management Studio always shows Microsoft Office 2010 in Processes on the Application column no matter what name I set on the VBA code. conn.ConnectionString = "UID=" & UID & ";PWD=" & PWD & ";DSN=" & DSN & _ ";Application Name = MyApp" How can I set the application name for monitoring purposes? 回答1: Ahh I see VBA connection string doesn't

Running multiple async queries with ADODB - callbacks not always firing

元气小坏坏 提交于 2019-11-27 20:46:57
I have an Excel workbook that fires three queries to a database to populate three tables on hidden sheets, and then runs three 'refresh' scripts to pull this data through to three visible presentation sheets (one per query). Running this synchronously is quite slow: The total time to refresh is the sum of the time of each of the three queries, plus the sum of the time for each 'refresh' script to run. I'm aware that VBA isn't multi-threaded, but I thought it would be possible to speed things up a bit by firing the queries off asynchronously (thus allowing some clean-up work to be done whilst

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-11-27 15:46:24
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 ) where the author says to change TypeGuessRows to "get the Jet to detect whether a mixed types

Passing Parameters to a Stored Procedure using ASP

淺唱寂寞╮ 提交于 2019-11-27 09:52:20
I'm trying to pass some parameters to a SQL stored procedure in my classic ASP. I've seen several posts on this and not sure what I'm doing wrong as I don't seem to see my discrepancy. set conn = CreateObject("ADODB.Connection") conn.open ("DSN=SERVER;UID=username;PWD=pwd;Database=MyDatabase") set cmd = Server.CreateObject("ADODB.Command") set cmd.ActiveConnection = conn cmd.CommandType = adCmdStoredProc cmd.CommandText = my_proc cmd.Parameters.Refresh cmd.Parameters(1) = "MyParam" set rs = cmd.execute I'm getting the error Arguments are of the wrong type, are out of acceptable range, or are

Error trying to call stored procedure with prepared statement

馋奶兔 提交于 2019-11-27 09:50:51
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 correct (I'm able to call it just by executing the string), and if I leave out the .CommandType and

VB6 ADODB.Recordset RecordCount property always returns -1

て烟熏妆下的殇ゞ 提交于 2019-11-27 07:40:37
问题 I am trying to get some old VB6 code to work with SQL Server Compact. I can connect, open the database and all seems well. I can run insert select commands which work. However the ADODB.Recordset RecordCount property always returns -1 even though I can access the Fields and see the data. Changing the CursorLocation = adUseClient causes a problem when executung the SQL (multiple-step operation generated errors). Option Explicit Private Const mSqlProvider As String = "Provider=Microsoft

Return recordset from function in classic ASP

我是研究僧i 提交于 2019-11-27 07:10:31
问题 I'm at a loss on how I can return a readable recordset from a function in classic ASP. This is what I came up with, but it's not working: Response.Clear Response.CharSet = "utf-8" Response.ContentType = "text/plain" Dim Count Set Count = Test Response.Write Count.Fields(0).Value Function Test Dim Query, Connection, Command, Recordset Query = " blah blah blah " Set Connection = Server.CreateObject("ADODB.Connection") Set Command = Server.CreateObject("ADODB.Command") Set Recordset = Server

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered in the local machine [closed]

不羁的心 提交于 2019-11-27 05:57:57
问题 I'm getting this error when trying to run a vb application on a another pc. Is there some place I can download this DLL? 回答1: http://www.microsoft.com/downloads/details.aspx?FamilyID=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en 回答2: I had already done that by using AccessDatabaseEngine_x64 as the server is 64 bit - Please see for reference Microsoft Access Database Engine 2010 Redistributable http://www.microsoft.com/downloads/en/details.aspx?FamilyID=C06B8369-60DD-4B64-A44B

VBScript & Access MDB - 800A0E7A - “Provider cannot be found. It may not be properly installed”

喜欢而已 提交于 2019-11-26 22:57:51
I've having a problem with a VBScript connecting to an access MDB Database. My platform is Vista64, but the majority of resources out there are for ASP/IIS7. Quite simply, I can't get it to connect. I'm getting the following error: 800A0E7A - "Provider cannot be found. It may not be properly installed" My code is: Set conn = CreateObject("ADODB.Connection") strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\database.MDB" conn.Open strConnect So far I have ran %WINDIR%\System32\odbcad32.exe to try to configure the Driver in 32bit mode, but it hasn't done the trick. Any suggestions