adodb

Is it necessary to close an Adodb.recordset object before setting it to nothing?

人走茶凉 提交于 2019-12-21 03:58:18
问题 Dim rs as ADODB.Recordset set rs = ReturnARecordset 'assume ReturnARecordset does just that... 'do something with rs rs.Close set rs = Nothing Is it necessary to call rs.Close before setting it to nothing? Edit: We have one global connection that we keep open for the duration of the application and all recordset objects use this same connection. I see two answers below talking about the need to close recordsets in order to ensure connections aren't left hanging open. To me that sounds like a

Why should I close and destroy a recordset?

人走茶凉 提交于 2019-12-20 04:38:17
问题 I read this article: http://www.utteraccess.com/wiki/Recordsets_for_Beginners, and it says that it's important for me to close and destroy RS's like this: rs.close Set rs = Nothing and if I don't, some bugs may happen. What kind of bugs? What does rs.close means? Does it mean that the connection to the database is kept open for as long as the rs isn't closed? 回答1: rs.close cleans up the resources that are used internally, however because ASP is a single process that doesn't have any GC the

SQL pivot function text file database with VBA Excel

无人久伴 提交于 2019-12-20 04:29:14
问题 We do not have access to SQL server at work so I have to design an app within Excel VBA and using a text file (CSV) to store the data. I have no problem querying data, joining the CSV's, but I would like to use the SQL Pivot/Unpivot statement to transpose one of the columns into rows. I'm not sure if that functionality exists as I keep getting the error that there's a syntax error in my FROM clause. Public Function getData() As ADODB.Recordset Dim path As String, conn As ADODB.Connection, rs

ADODB Connection String for .csv

旧城冷巷雨未停 提交于 2019-12-19 11:42:56
问题 I want to process .csv files with ADODB in Excel VBA. I tried a few strings found on web, but none of them seems to work. I'm getting file path using: strVFile = Application.GetOpenFilename("CSV (*.csv), *.csv") And then I pass strVFile as a parameter to the sub objReport.Load strVFile . The header of the sub is: Public Sub Load(ByVal strFilename As String) . Then I try to make ADODB connection using string: pconConnection.ConnectionString = _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &

PHP interpreter gets undefined constant OCI_COMMIT_ON_SUCCESS with ADODB

懵懂的女人 提交于 2019-12-19 09:03:36
问题 I wrote a php script that must be run on the php interpreter (Without Apache), which uses the adodb library with an Oracle database, but when I try to run it, I'm getting the following error: PHP Notice: Use of undefined constant OCI_COMMIT_ON_SUCCESS - assumed 'OCI_COMMIT_ON_SUCCESS' in c:\proyect\backend\libraries\adodb\adodb.inc.php on line 4248 I've checked, and have both the php_oci8 and php_oci8_11g enabled, so the constant SHOULD be defined. Also, when I run this script WITH Apache, it

Troubleshooting a Parameterized SQL Statement in asp

醉酒当歌 提交于 2019-12-19 08:22:31
问题 I'm trying to secure some legacy code written in what I guess is VB or asp(Not really sure if there is a difference). When I try to execute the statement the page gets an internal server error. I'm convinced this is a result of the connection but I don't know the language well enough to know how to troubleshoot it. What I know of the language and the ADODB library has come from W3Schools documentation and this post. Here is the code I have written (Identifying information redacted) SET Conn

Using SQLDataReader instead of recordset

落花浮王杯 提交于 2019-12-18 12:33:07
问题 I am new to this and had this question. Can I use SQLDataReader instead of a Recordset. I want to achieve the following result in an SQLDataReader. Dim dbConn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim sqlstr As String = "SELECT Name,Status FROM table1 WHERE id=" + item_id.Value.ToString rs.Open(SQL, dbConn) While Not rs.EOF txtName.Text = rs.Fields.Item("Name").Value ddlstatus.SelectedIndex = 1 rs.MoveNext() End While rs.Close() rs = Nothing dbConn.Close() dbConn = Nothing Can

VBA function in Excel ADODB query

我是研究僧i 提交于 2019-12-18 08:47:44
问题 I'm opening an ADODB connection in Excel 2007 to query one of the worksheets of the current workbook. When trying to add a custom VBA function, an error raises "Undefined function name". The connection: Dim connection As String Dim records As ADODB.Recordset Dim query As String Dim fileName As String fileName = ThisWorkbook.FullName connection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & fileName & ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"";" query = "select t.[Col1] from

Using ADODB to access opened xls file

泪湿孤枕 提交于 2019-12-18 06:49:11
问题 Although I've been working with VBA for Excel for quite a long time, I've one problem I cannot solve by myself. I've described it below, hope to get some help or advice. I'm using Excel 2007 and Windows XP, all updated with newest patches. I'm very often using following code to get data from another workbook: Set conn = New ADODB.Connection conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=g:\source.xls;Extended Properties=Excel 8.0;" Sql = "SELECT Field1, Field2 FROM [Sheet1$]" Set

Using ADODB to access opened xls file

雨燕双飞 提交于 2019-12-18 06:49:11
问题 Although I've been working with VBA for Excel for quite a long time, I've one problem I cannot solve by myself. I've described it below, hope to get some help or advice. I'm using Excel 2007 and Windows XP, all updated with newest patches. I'm very often using following code to get data from another workbook: Set conn = New ADODB.Connection conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=g:\source.xls;Extended Properties=Excel 8.0;" Sql = "SELECT Field1, Field2 FROM [Sheet1$]" Set