recordset

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

大憨熊 提交于 2019-11-29 05:14:07
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 in MS-Access VBA (using ADODB recordset) I had to install the MDAC to get the msado15.dll and once I

Why clone an MS-Access recordset?

十年热恋 提交于 2019-11-28 07:43:17
问题 I'm a newbie at VBA and attempting to understand someone else's code. Set rstClone = Me.RecordsetClone rstClone.MoveFirst Why does the recordset have to be cloned? Why can't the code be Me.Recordset.MoveFirst? 回答1: You may wish to use the recordsetclone because you do not wish to affect the records displayed in the form, which me.recordset.movefirst would do. 回答2: First off, the recordset is not cloned -- the form's Recordsetclone exists as long as there is a recordsource, even if it contains

Using “SELECT SCOPE_IDENTITY()” in ADODB Recordset

给你一囗甜甜゛ 提交于 2019-11-28 07:43:11
问题 Using a VBA script in Excel, I'm trying to insert a new row into a table and then get back the identity value of that row. If I run: INSERT INTO DataSheet(databaseUserID, currentTimestamp) VALUES (1, CURRENT_TIMESTAMP); SELECT SCOPE_IDENTITY() in Management Studio, the row is inserted and it gives me the returned identity value as expected. However, when I run the exact same query through a ADODB recordset in VBA, I'm having trouble. The row is indeed inserted, but I can't access the identity

How to load picture into MS-Access Image control from ADO recordset field?

喜你入骨 提交于 2019-11-28 02:17:07
问题 Using: MS-Access 2013 SP1 x86 MS-SQL Server 2012 SP1 CU8 x64 Connection via ODBC DSN, SQL Server driver UpScene Database Workbench Pro v4.4.4 Pro for MS-SQL Server My Access 2013 application uses SQL Server 2012 as the backend database with ODBC. I'm using VBA/ADO to read/write data to the database. I have been unsuccessful so far in retrieving an image from the database and assigning it to an image control on an Access form. The image is stored in a SQL Server table (as a VARBINARY(MAX)

insert full ADO Recordset into existing ACCESS table WITHOUT LOOP

旧街凉风 提交于 2019-11-27 21:33:58
I have a filled ADO recordset in my VBA module. I also have a table in ACCESS that has exactly the same structure as the recordset. Now I fill the table using a loop (which is fine) going through each dataset record. What I am wondering: is there a way to insert an entire recordset into the access table? (and more importantly: would this be significantly faster) Here's a basic example (run from excel in this case) which illustrates using a disconnected recordset to add records. Sub Tester() Dim con As ADODB.Connection, rs As ADODB.Recordset Dim i As Long Set con = getConn() Set rs = New ADODB

Rowset does not support scrolling backward

主宰稳场 提交于 2019-11-27 15:43:21
I am trying to query a MySQL database with the below code: 'declare the variables Dim Connection Dim Recordset Dim SQL 'declare the SQL statement that will query the database SQL = "SELECT * FROM CUSIP" 'create an instance of the ADO connection and recordset objects Set Connection = CreateObject("ADODB.Connection") Set Recordset = CreateObject("ADODB.Recordset") 'open the connection to the database Connection.Open "DSN=CCS_DSN;UID=root;PWD=password;Database=CCS" Recordset.CursorType=adOpenDynamic 'Open the recordset object executing the SQL statement and return records Recordset.Open SQL

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

Rowset does not support scrolling backward

守給你的承諾、 提交于 2019-11-26 17:17:50
问题 I am trying to query a MySQL database with the below code: 'declare the variables Dim Connection Dim Recordset Dim SQL 'declare the SQL statement that will query the database SQL = "SELECT * FROM CUSIP" 'create an instance of the ADO connection and recordset objects Set Connection = CreateObject("ADODB.Connection") Set Recordset = CreateObject("ADODB.Recordset") 'open the connection to the database Connection.Open "DSN=CCS_DSN;UID=root;PWD=password;Database=CCS" Recordset.CursorType