|
 |
asp_databases thread: SQL Problem
Message #1 by "Noumaan Abubakar" <noumaan_abubakar@m...> on Wed, 23 May 2001 14:37:13
|
|
Can Someone help...
I use the aggregate function MIN() in an sql statement, which is supposed
to return the earliest date in the SQL Database. However nothing is
returned.
The code that I use is (I have created a connection object called Conn):
Set RS = Server.CreateObject("ADODB.Recordset")
sqlstr = "SELECT MIN(open_date) FROM cases"
RS.Open sqlstr, Conn, 3
datevar = RS.DataMember
Response.Write datevar
Does anyone know what is wrong with the code and why its not returning
anything??
Thanks in advance
Noumaan Abubakar
Message #2 by "Blake, Shane" <Shane.Blake@p...> on Wed, 23 May 2001 09:48:04 -0400
|
|
try this :
sqlstr =3D "SELECT MIN(open_date) FROM cases"
Set RS =3D Conn.Execute(sqlstr)
datevar =3D RS(0)
Response.Write datevar
-----Original Message-----
From: Noumaan Abubakar [mailto:noumaan_abubakar@m...]
Sent: Wednesday, May 23, 2001 10:37 AM
To: ASP Databases
Subject: [asp_databases] SQL Problem
Can Someone help...
I use the aggregate function MIN() in an sql statement, which is
supposed
to return the earliest date in the SQL Database. However nothing is
returned.
The code that I use is (I have created a connection object called
Conn):
Set RS =3D Server.CreateObject("ADODB.Recordset")
sqlstr =3D "SELECT MIN(open_date) FROM cases"
RS.Open sqlstr, Conn, 3
datevar =3D RS.DataMember
Response.Write datevar
Does anyone know what is wrong with the code and why its not returning
anything??
Thanks in advance
Noumaan Abubakar
Message #3 by "Junaid hasan" <jnd_hsn@h...> on Wed, 23 May 2001 08:50:11 -0500
|
|
Try this
Set RS = Server.CreateObject("ADODB.Recordset")
sqlstr = "SELECT MIN(open_date) MinDate FROM cases"
RS.Open sqlstr, Conn, 3
If not RS.EOF Then
datevar = RS("MinDate")
end if
Response.Write datevar
>From: "Noumaan Abubakar" <noumaan_abubakar@m...>
>Reply-To: "ASP Databases" <asp_databases@p...>
>To: "ASP Databases" <asp_databases@p...>
>Subject: [asp_databases] SQL Problem
>Date: Wed, 23 May 2001 14:37:13
>
>Can Someone help...
>
>I use the aggregate function MIN() in an sql statement, which is supposed
>to return the earliest date in the SQL Database. However nothing is
>returned.
>
>The code that I use is (I have created a connection object called Conn):
>
>
>Set RS = Server.CreateObject("ADODB.Recordset")
>
>sqlstr = "SELECT MIN(open_date) FROM cases"
>
>RS.Open sqlstr, Conn, 3
>
>datevar = RS.DataMember
>
>Response.Write datevar
>
>
>Does anyone know what is wrong with the code and why its not returning
>anything??
>
>Thanks in advance
>
>Noumaan Abubakar
>
|
|
 |