adodb

querying csv with vbs

蓝咒 提交于 2019-12-24 11:25:40
问题 There's a csv file like so, I can read it easily enough with the code below. But as you can see there are multiple name1, group1, status1, name2, group2, etc columns in the csv. Each user will have a different number of columns. I was wondering if there is a way to use wild cards where I'm calling objRecordset.Fields.Item("Group1") something like ("Group%") or if I can auto increment the number until no records are found UserName,Domain,Site,MCO,Name1,Group1,Status1,Name2,Group2,Status2,Name3

Reading multiple recordsets

二次信任 提交于 2019-12-24 09:30:17
问题 I have a Stored proc which returns 6 select statement results. I'm trying to use one record set to execute sp and get records for each select statement but i get 0 or empty records when i read them, How can i query record set with multiple select statements from stored procedure? ex: Set rs = Server.CreateObject("ADODB.Recordset") strSql = "Exec [dbo].[xyz] '"&param1&"', '"&param2&"', '"&param3& "'" rs.open strSql,CN,3,3 Do While Not rs.EOF if rs.recordcount > 0 then r1 = rs.GetString(, , ",

Get Row number of excel using ADO

别等时光非礼了梦想. 提交于 2019-12-24 09:26:41
问题 We are trying to get the row number of particular recordset retreived based on soome condtion. consider below table Name Id abc 1 cde 2 efg 3 Now, how to get the row number or recordset number of employee "cde" (accrding to below code we need to get the result as 2). Any help on this please. Const adOpenStatic = 3 Const adLockOptimistic = 3 Const adCmdText = &H0001 strSource="C:\Test.xls" strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strSource & ";Extended Properties="

Execute method does not consistently execute all command text

元气小坏坏 提交于 2019-12-24 08:31:02
问题 I have below procedure to execute multiple command text to update an Access Table from Excel. Private Sub LogToDBMult(ParamArray sqlstr()) Dim con As Object, i As Integer Set con = getCon() With con For i = LBound(sqlstr) To UBound(sqlstr) If sqlstr(i) <> "" Then .Execute sqlstr(i) Sleep 1000 '/* this is an API call */ DoEvents End If Next .Close Set con = Nothing End With End Sub Private Function getCon() As Object Dim oCon As Object Dim sCon As String sCon = "Provider=Microsoft.ACE.OLEDB.12

ADODB recordset column headers

人盡茶涼 提交于 2019-12-24 08:18:35
问题 I'm copying ADODB.Recordset data to excel file, but it copies the recordset data to excel without column headers.I'm using MS Access 2013, CompyFromRecordset command. my question is, is there any way to copy the data headers of RecordSet? For i = 0 To iFieldCount - 1 objSheet.Range("A" & i + 1).CopyFromRecordset rst objBook.Save Next i 回答1: A "header" is not a record and the CopyFromRecordset command does not include the headers. You must put the header in your sheet yourself by iterating

ADODB recordset column headers

烈酒焚心 提交于 2019-12-24 08:17:02
问题 I'm copying ADODB.Recordset data to excel file, but it copies the recordset data to excel without column headers.I'm using MS Access 2013, CompyFromRecordset command. my question is, is there any way to copy the data headers of RecordSet? For i = 0 To iFieldCount - 1 objSheet.Range("A" & i + 1).CopyFromRecordset rst objBook.Save Next i 回答1: A "header" is not a record and the CopyFromRecordset command does not include the headers. You must put the header in your sheet yourself by iterating

'Type Mismatch' Error on ADODB.Recordset

♀尐吖头ヾ 提交于 2019-12-24 05:53:38
问题 I have a program that is supposed to read data from an SQL database and report back to Excel. It works as expected on a 32-bit machine, but since I moved over to a 64-bit work environment, the program has failed to run. Here is a sample of my code (the first error returned): Private Sub SearchBox_Change() ResultBox.Clear Call CompileQuery 'If the query is empty If SearchBox.Value = "" Then NumShowingLabel = "Showing 0 of 0 Results" ResultBox.Clear GoTo noSearch End If 'Open a new query with

How to save a text file (CSV) with UTF-8 without BOM encoding in VBA (Excel)?

烂漫一生 提交于 2019-12-24 04:22:17
问题 So this was my initial question. The answer to my question below, seems to be that the only solution to get UTF-8 (and UTF-8 without BOM) encoding, is to use the ADODB.Stream object. The answer to my new question in the subject line is posted as a code. I am sitting here and trying to Save an Excel sheet as a .CSV -file with a VBA macro. However, I am wondering if it matters whether I use ADODB / ADODB.Stream or just .SaveAs Fileformat:=xlCSV . I have tried to Google it, and it seems like I

How to save a text file (CSV) with UTF-8 without BOM encoding in VBA (Excel)?

一个人想着一个人 提交于 2019-12-24 04:21:03
问题 So this was my initial question. The answer to my question below, seems to be that the only solution to get UTF-8 (and UTF-8 without BOM) encoding, is to use the ADODB.Stream object. The answer to my new question in the subject line is posted as a code. I am sitting here and trying to Save an Excel sheet as a .CSV -file with a VBA macro. However, I am wondering if it matters whether I use ADODB / ADODB.Stream or just .SaveAs Fileformat:=xlCSV . I have tried to Google it, and it seems like I

Recommendation for Embedded DB with External ODBC Access?

﹥>﹥吖頭↗ 提交于 2019-12-24 03:08:15
问题 Is there a database that can be embedded in a Java program but also allow access through ODBC; more specifically, ODBC through ADOdb? The environment is MS Windows (XP on). The situation is that a Java program (mine) runs an external program (not mine) that uses an ADOdb.Connection object to connect to the embedded database and extract data. Oh, legacy support. I've been trying to set this up using Derby (i.e. JavaDB/Cloudscape) and the NetworkServerControl object, but cannot figure out how