Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: catching data from db


Message #1 by "zsuzsa shiri" <zsuzsashiri@h...> on Sun, 29 Apr 2001 07:28:40
Hi, 

When I try to catch some data from the db with the following code: 

Set oRsTmp = oConn.Execute("Select max(ThreadId) + 1 from " & Db_Table)

TId = oRsTmp(0)



I am getting the following errro message about the second line(TId = oRsTmp

(0)): 



Microsoft OLE DB Provider for ODBC Drivers error '80004005' 



[Microsoft][ODBC Driver Manager] Driver does not support this parameter 

  COuld someone help me pls?



Thanx, Zs
Message #2 by "Charles Feduke" <webmaster@r...> on Sun, 29 Apr 2001 12:08:18 -0400
    Whenever you're dealing with object variables, you cannot use =, you must

use Set var = var2:



Set TId = oRsTmp(0)



- Chuck



----- Original Message -----

From: "zsuzsa shiri" <zsuzsashiri@h...>

To: "ASP Databases" <asp_databases@p...>

Sent: Sunday, April 29, 2001 7:28 AM

Subject: [asp_databases] catching data from db





> Hi,

> When I try to catch some data from the db with the following code:

> Set oRsTmp = oConn.Execute("Select max(ThreadId) + 1 from " & Db_Table)

> TId = oRsTmp(0)

>

> I am getting the following errro message about the second line(TId = oRsTmp

> (0)):

>

> Microsoft OLE DB Provider for ODBC Drivers error '80004005'

>

> [Microsoft][ODBC Driver Manager] Driver does not support this parameter

>   COuld someone help me pls?

>

> Thanx, Zs



Message #3 by John Wicks <j_wicks@p...> on Mon, 30 Apr 2001 04:32:21 -0700
Hello Zs,



Change your sql statement like this...

Set oRsTmp = oConn.Execute("SELECT (MAX(ThreadId) + 1)  AS MaxID FROM " &

Db_Table)

TId = oRsTmp("MaxID")



I prefer aliases so that the code is a little more readable. If you prefer

the number syntax then you'll need to start with (1).Value or explicitly use

the Fields(1).Value



so your code would look something like this

Set oRsTmp = oConn.Execute("SELECT MAX(ThreadId) + 1 FROM " & Db_Table)

TId = oRsTmp(1).Value



I've assumed oConn has been correctly opened, Db_Table holds the name of a

an actual table and ThreadID is a field in that table.



John Wicks



----- Original Message -----

> Subject: catching data from db

> From: "zsuzsa shiri" <zsuzsashiri@h...>

> Date: Sun, 29 Apr 2001 07:28:40

> X-Message-Number: 2

>

> Hi,

> When I try to catch some data from the db with the following code:

> Set oRsTmp = oConn.Execute("Select max(ThreadId) + 1 from " & Db_Table)

> TId = oRsTmp(0)

>

> I am getting the following errro message about the second line(TId 

oRsTmp

> (0)):

>

> Microsoft OLE DB Provider for ODBC Drivers error '80004005'

>

> [Microsoft][ODBC Driver Manager] Driver does not support this parameter

>   COuld someone help me pls?

>

> Thanx, Zs






  Return to Index