Ask a Question related to ASP Database, Design and Development.
-
Bruno Alexandre #1
using Command to set Parameters and Recordset to retrive the Query
Hi guys,
withou using SP, I want to be able to add a Parameter to the SQL Query and
retrive the Recordset so I can use the Paging property under the recorset
object.... how can I do this?
I'm stuck here.
Set cnData = server.createObject("ADODB.Command")
Set rsData = server.createObject("ADODB.RecordSet")
' set the page size
rsData.PageSize = iPSize
rsData.CursorLocation = adUseClient
' open the data
sSQL = " SELECT * FROM vATSlistaAssistencias " & _
" WHERE estado = 'ACTIVO' and estadoEsc not in ('FORA SERVICO', 'NAO
QUER', 'NAO TEM MAQUINA', 'OUTRA 2') and " & _
" idDistribuidorAssistencia = @idDistAss and localidade like @localidade
" & _
" ORDER BY @coluna @ordem"
with cnData
.ActiveConnection = sConnCW
.CommandText = sSQL
.CommandType = adCmdText
.Parameters.Append = .CreateParameter("@idDistAss", adInteger,
adParamInput)
.Parameters.Append = .CreateParameter("@localidade", adVarChar,
adParamInput, 100)
.Parameters.Append = .CreateParameter("@coluna", adVarChar, adParamInput,
100)
.Parameters.Append = .CreateParameter("@ordem", adVarChar, adParamInput,
5)
.Parameters("@idDistAss") = idDistAssistencia
.Parameters("@localidade") = sLocalidade
.Parameters("@coluna") = sColuna
.Parameters("@ordem") = sOrdem
end with
set rsData = cnData.execute
cnData.ActiveConnection.Close
I got an Error regarding the @idDistAss is not define in the query
[Microsoft][ODBC SQL Server Driver][SQL Server]Must declare the variable
'@idDistAss'
But, as you can see, I have it defined in the sSQL variable...
What can I do? I'm really stuck here, please help mew
--
Bruno Miguel Alexandre
Dep Informática do Grupo Filtrarte
Av General Humberto Delgado, 91
Vila Verde
2705-887 Terrugem SNT
Portugal
T. +351 219 608 130
F. +351 219 615 369
w. [url]www.filtrarte.com[/url]
@. [email]bruno@filtrarte.com[/email]
Bruno Alexandre Guest
-
Command Object and RecordSet ASP
I am very knew to asp and Im having problems returning the results from my stored procedure in the browser. The asp code and the html form code is... -
Too few parameters to RecordSet.Open?
Hi All! My ASP page below receives the following error: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) Too few... -
SPs/Command Object/Parameters Problem
I've searched through google groups and cannot find an answer to this: My application passes values from a form to a page that requests them and... -
Projector with command line parameters
Hello, is it possible to build a projector, which can be started with command line parameters? If yes, how can I get access to this parameters... -
Command Parameters
Can someone tell me why the following code does not work ? It does not crash or cause errors and it creates a new row in the table "tblusers" but... -
Bob Barrows #2
Re: using Command to set Parameters and Recordset to retrive the Query
Bruno Alexandre wrote:
Already answered in .general.> Hi guys,
Please don't multipost. This question dealt with asp and databases so this
was the perfect forum in which to post it. You gained nothing by posting it
in .general as well (except wasting the time of myself and others who had to
read this a second time). If anyone had taken their time and energy to
answer the question here, only to find it had already been answered in the
other newsgroup, they would have been sufficiently annoyed to at least
consider ignoring any further posts from you. Post to ONE relevant
newsgroup.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest



Reply With Quote

