473,549 Members | 2,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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").va lue ) 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.CreateParam eter("b_arr", adVarChar, adParamInput,50 )
cmd.Parameters. Append b_arr
cmd("b_arr").va lue = p_arrange & " " & p_order

strsql = "select cons.consignmen t_no, "
strsql = strsql & " cons.internal_c on_no, "
strsql = strsql & " cons.item_count , "
strsql = strsql & " cons.declared_w eight, "
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_bran ch, "
strsql = strsql & " bch_col.code as collection_bran ch_code, "
strsql = strsql & " to_char(cons.ac tual_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.de fault_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_co de_current "
strsql = strsql & " left outer join branches bch_col on bch_col.code =
cons.branch_cod e_collection "
strsql = strsql & " left outer join branches bch_del on bch_del.code =
cons.branch_cod e_delivery "
strsql = strsql & "where cons.id is not null "
strsql = strsql & "order by ? ;"

Jul 22 '05 #1
1 5101
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.btint ernet.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").va lue ) 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.CreateParam eter("b_arr", adVarChar, adParamInput,50 )
cmd.Parameters. Append b_arr
cmd("b_arr").va lue = p_arrange & " " & p_order

strsql = "select cons.consignmen t_no, "
strsql = strsql & " cons.internal_c on_no, "
strsql = strsql & " cons.item_count , "
strsql = strsql & " cons.declared_w eight, "
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_bran ch, "
strsql = strsql & " bch_col.code as collection_bran ch_code, "
strsql = strsql & " to_char(cons.ac tual_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.de fault_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_co de_current "
strsql = strsql & " left outer join branches bch_col on bch_col.code =
cons.branch_cod e_collection "
strsql = strsql & " left outer join branches bch_del on bch_del.code =
cons.branch_cod e_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
1619
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, sometimes, the application stop working. In the moment that application fails, the only way to get it working again is to restart WebSphere server...
1
2415
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 related which is resulting performance issues if it is not a bind variable *---------------------------------* Posted at: http://www.GroupSrv.com...
1
2690
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: DECLARE get_tabs CURSOR local fast_forward FOR SELECT distinct tablename, id, shcontig1dt, shcontig2dt FROM db_ind
2
3377
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 1~12 to represent months, but I want to show them as Jan/.../Dec. So I thought I could write a simple function to convert it and call that function...
2
9725
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 does not change much from one minute to the next. Just the timestamp. While this application runs 24/7, the error occurs once or twice a day (It's an...
2
14192
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 AF_updateAlleleTmp { Connection m_alleleCon;
0
1430
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
2196
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 it works properly declare i number:=0; begin while i<3 loop
6
6264
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 execution of the stored procedure and the insert are in a FOR-LOOP. insert into ccd_t (acct_id, acct_seq_no, acct_btn) values
0
7527
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7459
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7726
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5377
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5097
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1953
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.