How to handle arabic form fields properly from classic asp? - tsql

I have t-sql scalar function to validate logins, which works nicely when asked from management studio:
select dbo.getLogin(N'نصير الفتلاوي',N'pass')
returns 1
when used from asp page with form fields as arguments, it returns 0 although constructed sql when pasted in sql management studio returns 1
If user name doesn't use arabic alphabet code then it works from asp as well.
The SQL Server version is 2008, IIS is 7.5 running on Windows Server 2003.
It behaves the same in IE 10 and Firefox.
ASP page charset is utf-8 set with meta directive.

When you call SQL Server from ASP, your parameters must be nvarchar. Not varchar.
This is the same as adding the N prefix to the raw SQL constants

Related

How do I format the script stored in information_schema.routines

We have an internal resource used by our developers and support to help identify data issues when we are diagnosing problems in our system. It's used to support a collection of data feeds and they are very customized. What we would like to do is allow one of our users to click the name of a stored procedure and then view the CREATE script of that stored procedure. This is done on an ASP.NET form.
I can get this information by using this statement:
select object_definition(object_id(routine_name))
from information_schema.routines
where routine_name like '%sprocname%'
However, the returned script is unformatted and in a single cell, on a single line. Is there a way for me to format this as if I had right-clicked on the stored procedure in SSMS and select "Script stored procedure as CREATE to"? Because it is all on a single line, if I have commented any portion of the procedure out using two dashes it comments the entire rest of the procedure that follows it.

Get List of Values (LOV) from sql query in JasperReport

In Oracle Reports I am able to run reports which get parameters by querying from database. In PHP/mySQL I am able to populate data in HTML dropdown menu by using sql query.
I would like to do the same in my JasperReports, either using JasperReport Studio or using JasperReport Server input controls. The current LOV I am able to get using JReport 'Input Controls' makes me enter options manually.
This is what I am trying to explain in words:
You can do this with an Input Control in JasperServer. When in the Create Input Control page of the wizard choose a Type of Single-select Query. This will enable you to enter a SQL query so you can provide a list of options from the database.
There is also a Multi-select Query alternative.

Jasperreport parameter selection from SQL query

I wanted to create a JasperReport which asks the user for a deliverer before it creates a report with data of the last the deliveries of the selected deliverer.
The problem, how I can do that? I found only examples where a parameter is created and the ArrayList is filled statically. But in my parameter I need the query result over the table of deliverers filled.
Can anybody tell me a possible solution?
I'm using Jaspersoft Server 5.1 which directly access a PostgreSQL database which has a datawarehouse structur. So it's not possible to use Java code.
Here is the documentation for adding input controls to reports in JasperReports Server:
http://community.jaspersoft.com/documentation/jasperreports-server-user-guide/adding-input-controls
Scroll down to the section that deals with query-based input controls. Your input control will have a name, such as deliverer. In your report, you must add deliverer as a parameter and reference it in your query, as you have done in your comment.

Filtering fields containing foreign characters (Chinese) in Access 2010?

I have an access 2010 database that contains foreign characters and this data needs to be filtered, searched ect...
The data is stored in a SQL database using NVARCHAR. Visually they look good but when I go to search on the a field that has these characters I am unable to use the like function. I can get an exact match.
I am able to search for the foreign characters in SQL.
In the front end access 2010 DB that this is attached to when I filter on these columns I am unable to get an exact match or a like match.
It looks lke the sorting function works properly.
How can I get the filtering, sorting ect to function properly in Access 2010?
Thank you for your help.

Selection Formula Pass-through not working with SQL Command Object

I'm using Crystal Reports XI. We use Crystal Reports embedded into a share point site written in C#/ASP.net. Our web developers instatiate a report in code and pass the selection criteria by appending to the Select Formula object.
The problem I'm running in to is that when I use a SQL Command Object, the selection formula is not being passed to the sql server as a where clause. This causes the entire result set to be queried and then limited on the server. For very large tables, this is causing a significant performance hit.
Here's an example:
SELECT foo.id, foo.code, foo.name
FROM foo foo
Select criteria is shown as:
{Command.name} like "someName"
If I then run the report the entire foo table is queried and then crystal reports limits from the entire set.
If instead I do it based on the table without a command object, the WHERE clause is appended to the sql query and all the limiting is done at the db level.
I'm assuming this occurs because a SQL command could potentially be very complex and adding a WHERE clause to the bottom isn't always possible. My question then, is there any good way to force some sort of pass through. Should I be talking to the C# devs and asking them to rework the way we pass parameters?
Thanks for any help and discussions.
A record-selection formula is never added to the Command-object's query.
I'm not certain if the CR SDK supports Command object modification (I know it supports read-only access, however).
The Command object does support parameters (in 2008, they can be multi-valued parameters) which can be accessed programmatically (they are converted to Parameter Fields in the report).
I'm assuming that you are using a Command object because of the query's complexity. If you can push the complexity to a SQL view, then use the 'visual linking' expert to create your query, you'll have more flexibility.