adodb

VBA ADODB multirow insert not working

人盡茶涼 提交于 2019-12-14 03:57:48
问题 I am trying to figure out how to do multirow inserts using ADODB in VBA excel. My problem seems to be that i can`t figure out the correct syntax to use for this simple task, even after searching I am still lost as to why it does not work. I have no problem doing a single insert using the statement INSERT INTO test.dbf ('field1','field3') VALUES ('test1','test11') But as soon as I try INSERT INTO test.dbf ('field1','field3') VALUES ('test1','test11'), ('test2','test22') It gives me the

Error when adding parameters to ADODB command in a .NET assembly

不羁的心 提交于 2019-12-14 03:52:54
问题 I have a .NET assembly that is being consumed by a classic ASP page. I've created a method that returns a ADODB recordset. In my ADODB command object I'm supplying parameters using the following format to a adCmdStoredProc CommandType property... With ADODBCmd .ActiveConnection = ADODBConn .Prepared = True .CommandType = CommandTypeEnum.adCmdStoredProc .NamedParameters = True .CommandText = Sql_GetMyBook .Parameters.Append(.CreateParameter("@book", DataTypeEnum.adChar, ParameterDirectionEnum

ADODB recordset in VBA says excel field is empty when it's not

孤者浪人 提交于 2019-12-14 02:51:45
问题 I have an excel sheet I need to import in my Access database. The sheet looks like this: DATE RECEPTION DENOMINATION ITEM N° QUANTITE RECUE 06/01/2010 DVD-Sex & the City PCR-PA21550167 5 06/01/2010 DVD-Avatar Natie 2 PCR-PA21550209 10 I then transfer this file into the database using adodb: Dim rs2 As New ADODB.Recordset Dim cnn2 As New ADODB.Connection Dim cmd2 As New ADODB.Command Dim intField As Integer Dim strFile As String strFile = fncOpenFile If strFile = "" Then Exit Sub With cnn2

VBA Copy & Paste 3000 rows

江枫思渺然 提交于 2019-12-14 02:41:10
问题 my code below, whoch I've copied from a Yahoo Developers articles and changed accordingly, for Query, I want to copy and paste 2999 rows of insert statements from excel to Teradata. My current way doesn't copy and paste the entire range. If I swap this for: Cells(1, 1) & " " & Cells(2, 1) & " " & Cells(3, 1)....etc. until Cells(2999), it would work. A clever, simpler way of doing this please? As an aside, would you recommend an alternative method of inserting 2999 rows. The tables are already

ADODB::_RecordsetPtr::Open throws Exception like Query timeout Expired in c++

假装没事ソ 提交于 2019-12-13 18:08:36
问题 here i am trying to query a table of sql server 2008 r2 from my c++ application. It contains 21,54,514. but it throws an exception like "Query timeout expired" . below is my code base ADODB::_ConnectionPtr m_pDBConnection; ADODB::_RecordsetPtr m_pRS; m_pDBConnection.CreateInstance("ADODB.Connection"); m_pRS.CreateInstance("ADODB.RecordSet"); m_pRS->Open(wstrSQL.c_str(), _variant_t((IDispatch *) m_pDBConnection, true), ADODB::adOpenStatic, ADODB::adLockReadOnly, ADODB::adCmdText); When the

Connection to protected access accdb file throws “Wrong Password”

微笑、不失礼 提交于 2019-12-13 17:56:38
问题 I am trying to connect to an encrypted access 2013 accdb file which is using legacy encryption through an adodb vba procedure within an excel file. The Procedure fails at cn.open, I am using office 64 bits, error message: "It is not a valid Password". The particularity of this problem is, the password is correct, I can connect to the Access DB through Microsoft query just fine, and I can connect with another access DB with the code below. But when I try to use it on Excel, this error jumps in

PHP - Connect to two databases simultaneously on same server using ADBDB

雨燕双飞 提交于 2019-12-13 15:59:34
问题 Is it possible to open connections to two schemas on the same server using PHP 5.3/ADODB5/SQL Server 2008? Here's what I'm trying: // Connect to users database $connUsers = NewADOConnection('mssql'); $connUsers-> Connect($server, $user, $password, $dbNameUsers); $connUsers->SetFetchMode(ADODB_FETCH_ASSOC); // Connect to main database $conn = NewADOConnection('mssql'); $conn-> Connect($server, $user, $password, $dbNameMain); $conn->SetFetchMode(ADODB_FETCH_ASSOC); Either one works alone, but

Microsoft Access Database Engine 2010 Redistributable 64 bit only works if Enable 32-bit set to true

流过昼夜 提交于 2019-12-13 07:39:35
问题 I have an ASP classic application that I'm migrating from a Windows 2000 to Windows 2012 Server. It uses the following code to import xls files Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open "DRIVER={Microsoft Excel Driver (*.xls)}; IMEX=1; HDR=NO; Excel 8.0; DBQ=" & Server.MapPath("\Imports\") &"\"&fn& "; " and the following for csv files Set objConn = CreateObject("ADODB.Connection") Set objRS = CreateObject("ADODB.Recordset") objConn.Open "Provider=Microsoft.Jet.OLEDB.4

ADODB Recordset.Open giving syntax error excel to SQL

狂风中的少年 提交于 2019-12-13 06:59:46
问题 I'm toast, cannot figure out why I'm getting a SYNTAX error on the line rst.Open strSQL I've tried it with rst.Open strSQL, cnt, adOpenStatic, adLockReadOnly, adCmdText But it still gives me an error. I have a sneaking suspicion it has to do with how strSQL is taking a cell value and appending it to the end of a string. Any help is highly appreciated. Public Sub EzPz() Dim cnt As ADODB.Connection Dim rst As ADODB.Recordset Set cnt = New ADODB.Connection Set rst = New ADODB.Recordset Dim

Query to select records that do not appear in DB

谁说胖子不能爱 提交于 2019-12-13 03:33:10
问题 I am trying to add missing data to the DB and am therefore trying to collect this missing data through queries. In my excel sheet I have two columns: col A is populated with component codes, while col J holds its respective asset type codes. I want to find all non-existing component-asset type combinations in one query . Currently, I am looping through the excel sheet like in the following example: arr = Range("B3:J5000") For i = 1 To 5000-2 Set rs = cnn.Execute("Select Top 1 AT.Code From