ado

ADODB Command failing Execute with parameterised SQL query

﹥>﹥吖頭↗ 提交于 2019-12-31 03:36:09
问题 I have the following JScript code: var conn = new ActiveXObject ("ADODB.Connection"); conn.Open("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=blah_blah_blah;User=foo;Password=bar;"); var cmd = new ActiveXObject("ADODB.Command"); cmd.ActiveConnection = conn; var strSQL = "SELECT id FROM tbl_info WHERE title LIKE :search ORDER BY id"; var search = "test"; try{ cmd.CommandText = strSQL; var param = cmd.CreateParameter(':search', 200, 1, 100, search); cmd.Parameters.Append(param); var

ADO Connection Timeout problem

让人想犯罪 __ 提交于 2019-12-31 03:11:14
问题 Using TADOConnection class to connect to SQL server 2005 db. Having ConnectionTimeOut := 5; // seconds. Trying to open the connection synchronously. When the server is available and running, the connection time out works fine. If the server is not available or network connection is lost, then attempting to open a connection waits for more than 5 seconds (may be 20 secs). Is there any property or method that needs to be set to influence this behavior? 回答1: No, it's enough to set the

Problems with Recordset Filter

做~自己de王妃 提交于 2019-12-30 16:21:11
问题 I'm having trouble with a filter on an ADO Recordset in legacy ASP Classic code, and I'm trying to understand if what I'm trying to do is not supported, or if I'm just doing it wrong. I have a recordset of Items, and they have a Status of 1 (active) or 0 (inactive), and an optional End_Date. In my administrative user interface, I have a control to show all items or only those that should be displayed to end-users: Status = 1 AND ( End_Date is null OR End_Date > Date() ) To implement that

Problems with Recordset Filter

≡放荡痞女 提交于 2019-12-30 16:21:10
问题 I'm having trouble with a filter on an ADO Recordset in legacy ASP Classic code, and I'm trying to understand if what I'm trying to do is not supported, or if I'm just doing it wrong. I have a recordset of Items, and they have a Status of 1 (active) or 0 (inactive), and an optional End_Date. In my administrative user interface, I have a control to show all items or only those that should be displayed to end-users: Status = 1 AND ( End_Date is null OR End_Date > Date() ) To implement that

Retrieve ADO Recordset Field names (Classic ASP)

早过忘川 提交于 2019-12-30 06:11:11
问题 I wonder if someone can help: Long story short, I'm using MSSQL2005 to build a Pivot table. The data being examined is limited by date range (All data for 1 week starting from the nearest Monday to the date selected) When I run the Stored Proc and pass it a date, I get The correct table back eg: Time | 1 Jan 09 | 2 Jan 09 | 3 Jan 09 | ... 09:00 | 0 | 9 | 25 | ... 09:30 | 8 | 27 | 65 | ... 10:00 | 20 | 44 | 112 | ... (Apologies for the atrocious "table" formatting). The only problem I have is

How to use MySQL user-variables with ADO.NET

痴心易碎 提交于 2019-12-29 09:05:53
问题 MySQL SQL commands can contain user variables that start with '@'. The MySQL ADO.NET connector also uses '@' for command parameters. Is there a way to escape the '@' character so I can use a user-variable in an SQL statement sent to MySQL via ADO.NET? I'm trying to do something like this: UPDATE company SET next_job_id = @jobid:=next_job_id+1 WHERE company_id = @companyid; SELECT @jobid; Where @jobid is a MySQL user variable and @companyid is a parameter. 回答1: It's a connection string option

Why is my Access database not up-to-date when I read it from another process?

吃可爱长大的小学妹 提交于 2019-12-29 07:52:09
问题 In my application I do the follwing things: Open a Access database (.mdb) using Jet/ADO and VB6 Clear and re-fill a table with new data Close the database Start another process which does something with the new data. The problem is that sometimes the second process cannot find the new data. Sometimes the table is just empty, sometimes RecordCount > 0, but EOF is true and I cannot do a MoveFirst or MoveNext. In a nutshell: All kinds of weird things. My current workaround is adding a delay

How do I associate Parameters to Command objects in ADO with VBScript?

别说谁变了你拦得住时间么 提交于 2019-12-29 07:49:08
问题 I have been working an ADO VBScript that needs to accept parameters and incorporate those parameters in the Query string that gets passed the the database. I keep getting errors when the Record Set Object attempts to open. If I pass a query without parameters, the recordset opens and I can work with the data. When I run the script through a debugger, the command object does not show a value for the parameter object. It seems to me that I am missing something that associates the Command object

Anyway for ADO to read updated data from a read-only excel file before save? (VBA)

旧街凉风 提交于 2019-12-29 01:29:10
问题 I am using the following code to read data from Sheet1 of SAME Excel sheet. I load the data into the return array. The Excel sheet file has "read only" checked and is always opened in "READ ONLY" mode. The issue is that if I change any of the data on Sheet1, because the file is opened as "read only", it won't be reflected in the ADO query. ADO Continues to output what is in the "saved" file and ignores what has been updated in the temp read only version. For example the below pulls value

How can I detect that a TadoConnection lost the communication with the server?

瘦欲@ 提交于 2019-12-28 12:31:15
问题 I need to detect when a TAdoConnection component has lost the connection with the server. I've tried using the OnDisconnect event but this only fires when the Close method is called or the Connected property is set to false. Another option I've tried is using a TTimer and executing a query like this SELECT 1 RESULT FROM DUAL in the OnTimer event, catching any exception that occurs. Is there a better option to detect that the connection was lost? 回答1: I see the DUAL table. Means, you are using