S
Seb
Hello,
I work in a ASP page and a Access 97 base.
In Access, I have a request with a parameter (VAR_DATE).
With this code it's good :
<%
Set Req_1 = Server.CreateObject("ADODB.Command")
Req_1.ActiveConnection = MM_BASE_FIL_A_FIL_TER2N_STRING
'Z2_Req_Sans_FIL_Supp is a request in access with a parameter (VAR_DATE is
the parameter).
Req_1.CommandText = "Z2_Req_Sans_FIL_Supp"
Set parametre = server.CreateObject("ADODB.Parameter")
Set parametre = Req_1.CreateParameter("VAR_DATE")
parametre.Type = 7
parametre.Direction = 1
parametre.Value = "14/12/2007"
Req_1.Parameters.Append parametre
Set ADORecordset = Req_1.Execute
do while not ADORecordset.EOF
Response.Write ADORecordset("NUM_UNIQUE_ORIGINE") & "<br>"
ADORecordset.MoveNext
Loop
%>
My parameter is send to access and the result is good
But I want replace Z2_Req_Sans_FIL_Supp by a SQL request :
<%
Set Req_1 = Server.CreateObject("ADODB.Command")
Req_1.ActiveConnection = MM_BASE_FIL_A_FIL_TER2N_STRING
'This request in Access is good but in my ASP Page, the parameter is not
send to Access (ERROR : 1 parameter is request)
Req_1.CommandText = "SELECT Base_Modif.* "
Req_1.CommandText = Req_1.CommandText & " FROM Z1_Req_V_Fil_MAX_et_Date LEFT
JOIN Base_Modif ON Z1_Req_V_Fil_MAX_et_Date.MaxDeNUM_UNIQUE =
Base_Modif.NUM_UNIQUE "
Req_1.CommandText = Req_1.CommandText & " WHERE Base_Modif.STATUS<>'s'"
Set parametre = server.CreateObject("ADODB.Parameter")
Set parametre = Req_1.CreateParameter("VAR_DATE")
parametre.Type = 7
parametre.Direction = 1
parametre.Value = "14/12/2007"
Req_1.Parameters.Append parametre
Set ADORecordset = Req_1.Execute
do while not ADORecordset.EOF
Response.Write ADORecordset("NUM_UNIQUE_ORIGINE") & "<br>"
ADORecordset.MoveNext
Loop
%>
How can I send a parameter with a SQL request ? Is it possible ?
Thanks
Sébastien
I work in a ASP page and a Access 97 base.
In Access, I have a request with a parameter (VAR_DATE).
With this code it's good :
<%
Set Req_1 = Server.CreateObject("ADODB.Command")
Req_1.ActiveConnection = MM_BASE_FIL_A_FIL_TER2N_STRING
'Z2_Req_Sans_FIL_Supp is a request in access with a parameter (VAR_DATE is
the parameter).
Req_1.CommandText = "Z2_Req_Sans_FIL_Supp"
Set parametre = server.CreateObject("ADODB.Parameter")
Set parametre = Req_1.CreateParameter("VAR_DATE")
parametre.Type = 7
parametre.Direction = 1
parametre.Value = "14/12/2007"
Req_1.Parameters.Append parametre
Set ADORecordset = Req_1.Execute
do while not ADORecordset.EOF
Response.Write ADORecordset("NUM_UNIQUE_ORIGINE") & "<br>"
ADORecordset.MoveNext
Loop
%>
My parameter is send to access and the result is good
But I want replace Z2_Req_Sans_FIL_Supp by a SQL request :
<%
Set Req_1 = Server.CreateObject("ADODB.Command")
Req_1.ActiveConnection = MM_BASE_FIL_A_FIL_TER2N_STRING
'This request in Access is good but in my ASP Page, the parameter is not
send to Access (ERROR : 1 parameter is request)
Req_1.CommandText = "SELECT Base_Modif.* "
Req_1.CommandText = Req_1.CommandText & " FROM Z1_Req_V_Fil_MAX_et_Date LEFT
JOIN Base_Modif ON Z1_Req_V_Fil_MAX_et_Date.MaxDeNUM_UNIQUE =
Base_Modif.NUM_UNIQUE "
Req_1.CommandText = Req_1.CommandText & " WHERE Base_Modif.STATUS<>'s'"
Set parametre = server.CreateObject("ADODB.Parameter")
Set parametre = Req_1.CreateParameter("VAR_DATE")
parametre.Type = 7
parametre.Direction = 1
parametre.Value = "14/12/2007"
Req_1.Parameters.Append parametre
Set ADORecordset = Req_1.Execute
do while not ADORecordset.EOF
Response.Write ADORecordset("NUM_UNIQUE_ORIGINE") & "<br>"
ADORecordset.MoveNext
Loop
%>
How can I send a parameter with a SQL request ? Is it possible ?
Thanks
Sébastien