rquest.querystring cuts the value off before the & character - query-string

I've got a query string containing the following data:
{departmentId=C&L}
However, when I use the following code to get the data out of the query string DepartmentName = Request["departmentId"];
At the end the DepartmentName only contains the first letter C. So the result is: DepartmentName=C
So it can't find the page afterwords and returns a 404
So what am I doing wrong ?

Related

Search string which contains multiple words using CATSEARCH query in PL/SQL

String record : Blueoba Mountain Company
SQL Query :
SELECT from table
WHERE CATSEARCH(account_partner_name_type,'%Blueoba% %Mountain% %Company%', NULL) > 0)
where rn <=500;
If I write the full name of the string in the query (i.e.%Blueoba% %Mountain% %Company%) then it gives me the record.
But if I write %Blueoba% %Mountain% %Comp% or %Blue% %Company% or %Comp% then its not returning any record.
So ideally, if I write a word %comp% then it should search all the records which contains 'comp' word and show the records but its not showing.
Can anybody suggest something?
You can try using wild card characters
SELECT * from table
WHERE account_partner_name_type like '%Blueoba%'
and rn <=500;

Using InStr in Access VBA to lookup a string value from another table

Very new to access VBA and would love some guidance on this.
I am searching through a string and looking for a particular substring in this field. This substring would have a value based on another table, ie
order = "Reference order QQ131415"
The problem is, there is no particular pattern for order numbers. Some are 7 digits, some are 10 and some have dashes in there.
There is a table i have access too that has these order numbers though, and I guess I am trying to use that table as a dictionary.
my very very basic Access VBA code is like this
' order= Instr(1, rst![order], qst![order_id],vbBinaryCompare)'
order is the string where i have the order id i am trying to extract
order_id is the actual id from a seperate table.
Is this something that Access VBA can handle?
So i think this will help you
You're not very clear in the sentence following on from "order=" with your code. Could you clear that up.
Instr(string1, String2, [ compare ])
string1 Required. String expression being searched.
string2 Required. String expression sought.
Instr returns a Variant (number in this case) specifying the position of the first occurrence of one string within another. So it should be:
Position= InStr(1, string1, string2, 1)
So you'd now know that the ordernumber starts at position x in Order. You'd then have to do a left(Order, Len(order) -x) to extract the string.
Youd do that in a nested loop because youll have to loop through your dictionary per record in Order.
E.g.
Dim rsOrder as DAO.recordset
Dim rsOrderId as Dao.recordset
dim orderTest as integer
dim stringcapture as string
Set rsOrder = Currentdb.OpenRecordset("[SELECT STRING]")
rsOrder.Movefirst
Do until rsOrder.EOF or rsOrder.BOF
Order = rsOrder![OrderFieldName]
Set rsOrderId = Currentdb.OpenRecordSet("[SELECT STRING]")
rsOrderID.Movefirst
Do Until rsOrderID.EOF or rsOrderID.BOF
OrderID = rsOrderID![OrderIDFieldName]
orderTest = Instr(1, Order, OrderID,1)
StringCapture = left(Order, Len(order) -OrderTest)
rsOrderID.movenext
Loop
rsOrder.movenext
Loop
rsOrder.close
rsOrderID.close
Something to that affect.

Getting error with basic trim() function in U-SQL script

I want to apply .trim() function on a column but getting the error.
Sample data:
Product_ID,Product_Name
1, Office Supplies
2,Personal Care
I have to do some data manipulation but can't get the basic trim() function right.
#productlog =
EXTRACT Product_ID string,
Prduct_Name string
FROM "/Staging/Products.csv"
USING Extractors.Csv();
#output = Select Product_ID, Product_Name.trim() from #productlog;
OUTPUT #output
TO "/Output/Products.csv"
USING Outputters.Csv();
Error:
Activity U-SQL1 failed: Error Id: E_CSC_USER_SYNTAXERROR, Error Message: syntax error. Expected one of: '.' ALL ANTISEMIJOIN ANY AS BEGIN BROADCASTLEFT BROADCASTRIGHT CROSS DISTINCT EXCEPT FULL FULLCROSS GROUP HASH HAVING INDEXLOOKUP INNER INTERSECT JOIN LEFT LOOP MERGE ON OPTION ORDER OUTER OUTER UNION PAIR PIVOT PRESORT PRODUCE READONLY REQUIRED RIGHT SAMPLE SEMIJOIN SERIAL TO UNIFORM UNION UNIVERSE UNPIVOT USING WHERE WITH ';' '(' ')' ',' .
Try the below, afaik you need to alias trimmed fields
#productlog =
EXTRACT Product_ID string,
Prduct_Name string
FROM "/Staging/Products.csv"
USING Extractors.Csv();
#output = Select Product_ID, Product_Name.trim() as Trimmed_Product_Name from #productlog;
OUTPUT #output
TO "/Output/Products.csv"
USING Outputters.Csv();
Got it right finally, in case someone else face the same issue. U-SQL is more like C# so it will be a bit tricky for people like me, coming from pure SQL background.
Code:
#productlog =
EXTRACT Product_ID string,
Prduct_Name string
FROM "/Staging/Products.csv"
USING Extractors.Csv();
#output =
SELECT
T.Product_ID,
T.Prduct_Name.ToUpper().Trim() AS Prduct_Name
FROM #productlog AS T;
OUTPUT #output
TO "/Output/Products.csv"
USING Outputters.Csv();

how to search for a particular string in the given string in oracle

I have a string with value as '12A,12B,12C,13,14'.
I want to check whether '2A' is available in the above string.
while trying my value '2A' checks in 12A and returns as matched.
Please give me a solution for this.
You can do something like this:
select * from table where ',' || col || ',' like '%,2A,%';
Commas are concatenated to the column to cover the cases where the element is present at the start or end of the string.

get a array of values from the url in asp.net

I am using ASP.NET for the first time.
Here is my issue.
I have a ASP.NET page.
some other website redirects to my webpage and the url is
http://localhost/mysite/newpage.aspx?request=424718&to%5B0%5D=111832&to%5B1%5D=1186313&to%5B2%5D=100009#_=_
actually what that website send is a request value and an array of id 's
I have to get those values in my page and display them.
I have used #Request["request"] to get the request value.
But I do not know how to get the id values (since it is an array). I tried #Request["to"] and it gives null.
I also cannot understand that url encoding.. it is supposed to be like this
?request=3435&to=3495&to=435&to=3546
The ids & values that you are looking for, I believe, are in the URL. This is called the querystring.
Single Values
This code will output each key-value-pair from the querystring. If there are multiple values, they will be comma-delimited.
C#
foreach (String key in Request.QueryString.AllKeys)
{
Response.Write("Key: " + key + " Value: " + Request.QueryString[key]);
}
VB.NET
For Each key as String in Request.QueryString.Allkeys
Response.Write("Key: " & key & " Value: " & Request.QueryString(key))
Next
If you use the above code, you will notice that there is a comma-delimited list of values outputted for the to key. This is because the to key is used multiple times.
Multiple Values
This will output each key followed by each key's values.
foreach (String key in Request.QueryString.AllKeys)
{
var values = Request.QueryString.GetValues(key);
foreach (String item in values)
{
Response.Write("value: " + item + " ";
}
}
This will output each key and then each value for each key, even if there are multiple.
Reference
Is there a way to get all the querystring name/value pairs into a collection?

Resources