473,395 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Bind variable in asp

Hi all,

I'm using bind variables in sql in some asp pages, but something strange is
happening with a few of the pages.
I'm trying to add a bind variable to do an arrange and order of the output.
When I run the query it does not do the arrange and order, but if I type it
in how the bind sends it, it works. If I do a
response.write(cmd("b_arr").value ) it displays the correct information for
the arrange and order. In some other pages I do exactly the same and it
works. Has anyone come across something like this before?

Thanks in advance,
Hermes

Set b_arr = cmd.CreateParameter("b_arr", adVarChar, adParamInput,50)
cmd.Parameters.Append b_arr
cmd("b_arr").value = p_arrange & " " & p_order

strsql = "select cons.consignment_no, "
strsql = strsql & " cons.internal_con_no, "
strsql = strsql & " cons.item_count, "
strsql = strsql & " cons.declared_weight, "
strsql = strsql & " cons.item_type_code, "
strsql = strsql & " cons.updated_by, "
strsql = strsql & " acc.code as acc_code, "
strsql = strsql & " acc.name as acc_name, "
strsql = strsql & " ser.name as service, "
strsql = strsql & " bch_col.name as collection_branch, "
strsql = strsql & " bch_col.code as collection_branch_code, "
strsql = strsql & " to_char(cons.actual_collection_date, 'DD/MM/YYYY') as
collection_date, "
strsql = strsql & " bch_del.name as delivery_branch, "
strsql = strsql & " bch_del.code as delivery_branch_code, "
strsql = strsql & " to_char(cons.default_delivery_date, 'DD/MM/YYYY') as
delivery_date "
strsql = strsql & "from consignments cons "
strsql = strsql & " join accounts acc on acc.id = cons.account_id_for "
strsql = strsql & " left outer join services ser on ser.code =
cons.service_code_current "
strsql = strsql & " left outer join branches bch_col on bch_col.code =
cons.branch_code_collection "
strsql = strsql & " left outer join branches bch_del on bch_del.code =
cons.branch_code_delivery "
strsql = strsql & "where cons.id is not null "
strsql = strsql & "order by ? ;"

Jul 22 '05 #1
1 5094
What if you run the same query directly instead if using a parameter ? Does
it work then ?

Be aware also of sorting. I noticed you convert some dates to chars in your
query. Keep in mind that sorting a date or the text of a date is not the
same...

For now it would be to find out if hti s has somethign to do with the use of
parameters (which I rarely saw in an order by clause) or if this is related
to something else.

Patrice
--

"Hermes" <no****@nospam.com> a écrit dans le message de
news:co**********@sparta.btinternet.com...
Hi all,

I'm using bind variables in sql in some asp pages, but something strange is happening with a few of the pages.
I'm trying to add a bind variable to do an arrange and order of the output. When I run the query it does not do the arrange and order, but if I type it in how the bind sends it, it works. If I do a
response.write(cmd("b_arr").value ) it displays the correct information for the arrange and order. In some other pages I do exactly the same and it
works. Has anyone come across something like this before?

Thanks in advance,
Hermes

Set b_arr = cmd.CreateParameter("b_arr", adVarChar, adParamInput,50)
cmd.Parameters.Append b_arr
cmd("b_arr").value = p_arrange & " " & p_order

strsql = "select cons.consignment_no, "
strsql = strsql & " cons.internal_con_no, "
strsql = strsql & " cons.item_count, "
strsql = strsql & " cons.declared_weight, "
strsql = strsql & " cons.item_type_code, "
strsql = strsql & " cons.updated_by, "
strsql = strsql & " acc.code as acc_code, "
strsql = strsql & " acc.name as acc_name, "
strsql = strsql & " ser.name as service, "
strsql = strsql & " bch_col.name as collection_branch, "
strsql = strsql & " bch_col.code as collection_branch_code, "
strsql = strsql & " to_char(cons.actual_collection_date, 'DD/MM/YYYY') as
collection_date, "
strsql = strsql & " bch_del.name as delivery_branch, "
strsql = strsql & " bch_del.code as delivery_branch_code, "
strsql = strsql & " to_char(cons.default_delivery_date, 'DD/MM/YYYY') as
delivery_date "
strsql = strsql & "from consignments cons "
strsql = strsql & " join accounts acc on acc.id = cons.account_id_for "
strsql = strsql & " left outer join services ser on ser.code =
cons.service_code_current "
strsql = strsql & " left outer join branches bch_col on bch_col.code =
cons.branch_code_collection "
strsql = strsql & " left outer join branches bch_del on bch_del.code =
cons.branch_code_delivery "
strsql = strsql & "where cons.id is not null "
strsql = strsql & "order by ? ;"

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ClimberBear | last post by:
Hi, I've got a very strange problem with a Websphere 5.1 cluster attached to DB2 database in Mainframe z/OS. I have a J2EE deployed application running normally fine agains the DB2 host. But,...
1
by: k_mahesh7 | last post by:
I need tp bind a variable to a select and send to oracle database. I have the value to be send in a variable but that variable to be binded to the query as the database I an hitting is a siebel...
1
by: traceable1 | last post by:
SQL Server 2000 SP4 with AWE hotfix. Windows 2003 SP1. I have a stored procedure which is not working the way I think it should be. I have a CURSOR which has a variable in the WHERE clause: ...
2
by: duancg | last post by:
Hi, I wonder if someone could help since I wasn't able to find the answer through search. I have a simple .aspx page that shows data from a database table, as a table in UI. Now the data uses...
2
by: jeanbdenis | last post by:
Hi Folks, I have been struggling with this issues for the last couple of days. I have a java application which does an update to the database every 5 mins. The data written to the database...
2
by: lunas | last post by:
hi i am trying to update a table selecting a value from another table and ve written the following codes for it.. import java.sql.*; import java.io.*; import java.util.*; public class...
0
by: umesh049 | last post by:
CREATE OR REPLACE TRIGGER "NEO".TEMP_TR BEFORE INSERT ON TEMP FOR EACH ROW declare c_id number:=0; BEGIN select :new_ID into c_id from dual ; dbms_output.put_line(c_id); End;
5
by: femina | last post by:
can i use the bind variable inside a procedure and the query like update emp set empname=:name where empno=:no; but i work like update emp set empname=&name where empno=&no inside procedures...
6
by: pretzla | last post by:
I have a PL/SQL script where I load data from a stored procedure into bind variables. Then, I insert that data from the bind variables into an Oracle table with a simple insert statement. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.