Showing posts with label interesting. Show all posts
Showing posts with label interesting. Show all posts

Friday, March 30, 2012

Problems with the ReportViewer Control

Theclient side reportviewer control is used with a typed dataset in vs 2005.

But I have noticed something that is really interesting,

theturkish characters in the dataset are changed in the runtime enviroment when used with the reportviever control.

such as.

exec sp_executesql N'SELECT CASES._ID, CASES._OWNERID, CASES._LASTMODIFYDATE, CASES._DELETIONSTATUS, CASES._SECURITYCODE,
CASES._NAME, CASES._STATE,
CASES._DESCRIPTION, CASES._CATEGORY, CASES._TYPE, CASES.PRIORITY, CASES.REASON, CASES.ORIGIN, CASES.FROMDATE,
CASES.TODATE,
CASES.COMMENT, CASES.WHATID, CASES.WHATTYPE, VIEW_WHONAME.WHONAME, ORGANIZATION._NAME AS ORGANIZATIONNAME,
PERSON.HOMETEL, PERSON.EMAIL
FROM CASES INNER JOIN
VIEW_WHONAME ON CASES.WHOID = VIEW_WHONAME.WHOID INNER JOIN
PERSON ON VIEW_WHONAME.WHOID = PERSON._ID INNER JOIN
ORGANIZATION ON PERSON.WORKINGORGANIZATIONID = ORGANIZATION._ID
WHERE (CASES._OWNERID = @.ownerID) AND (CASES._ID = @.entityID) AND (VIEW_WHONAME.WHOTYPE =''KİÅ?İ'')',N'@.ownerID
smallint,@.entityID int',@.ownerID=1,@.entityID=30

-----------

>>> the bold area should be 'K???' which is a turkish string...

What sholud I do? Do I need to configure the sql server or do I need to configure asp.net runtime?

Is the data type of VIEW_WHONAME.WHOTYPE NVARCHAR? If yes, that means you've stored the unicode characters in SQL, so just make sure you're comparing it to unicode chars at runtime. You can mark a string as UNICODE in SQL by adding a N prefix in front of the string:

VIEW_WHONAME.WHOTYPE =N''KİÅ?İ''

|||

I did tried that but still the dataset in the app_code changes the string at runtime.When I test the dataset designer at design time, everything is just fine.

if there any configuration I have to make to stop asp.net runtime changing my strings?

----------------------------

exec sp_executesql N'SELECT CASES._ID, CASES._OWNERID, CASES._LASTMODIFYDATE, CASES._DELETIONSTATUS, CASES._SECURITYCODE,
CASES._NAME, CASES._STATE,
CASES._DESCRIPTION, CASES._CATEGORY, CASES._TYPE, CASES.PRIORITY, CASES.REASON, CASES.ORIGIN,
CASES.FROMDATE, CASES.TODATE,
CASES.COMMENT, CASES.WHATID, CASES.WHATTYPE, VIEW_WHONAME.WHONAME, ORGANIZATION._NAME AS ORGANIZATIONNAME,
PERSON.HOMETEL, PERSON.EMAIL
FROM CASES INNER JOIN
VIEW_WHONAME ON CASES.WHOID = VIEW_WHONAME.WHOID INNER JOIN
PERSON ON VIEW_WHONAME.WHOID = PERSON._ID INNER JOIN
ORGANIZATION ON PERSON.WORKINGORGANIZATIONID = ORGANIZATION._ID
WHERE (CASES._OWNERID = @.ownerID) AND (CASES._ID = @.entityID) AND (VIEW_WHONAME.WHOTYPE =N''KİÅ?İ'')',N'@.ownerID
smallint,@.entityID int',@.ownerID=1,@.entityID=30

|||finally I have sp?ved the problem by jsut saving the dataset using advanced save options and I gave the apporopiate encoding to it.|||finally I have solved the problem by just saving the dataset using advanced save options and I gave the apporopiate encoding to it.

Monday, February 20, 2012

Problems when running a stored procedure using a cursor via ODBC

Hello All,
This is an interesting one... I have a stored procedure on a
sql-server 2000. The procedure opens a cursor and then perform some
operations on a certain table.
When I run the procedure from a "sql query analyzer" window it works
fine, the cursor steps over all the necessary rows in the table but
when I run the procedure via ODBC (a tcl-script using "tclodbc") the
cursor behaves differently. It seems that the select used when opening
the cursor does not return all the necessary rows.
Are there any known issues when running a stored procedure via an ODBC
connection?
It is not a "user rights" problem.
Sincerely,
Tobias A
I'm not familiar with TCLODBC but maybe it's a problem specific to that
product. My suggestion is that you try to rewrite your code without a
cursor. Cursors are rarely necessary and almost always an inefficient
solution. Maybe if you stick to standard SQL there's a better chance that
your code will be correctly supported by TCLODBC.
David Portas
SQL Server MVP

Problems when running a stored procedure using a cursor via ODBC

Hello All,
This is an interesting one... I have a stored procedure on a
sql-server 2000. The procedure opens a cursor and then perform some
operations on a certain table.
When I run the procedure from a "sql query analyzer" window it works
fine, the cursor steps over all the necessary rows in the table but
when I run the procedure via ODBC (a tcl-script using "tclodbc") the
cursor behaves differently. It seems that the select used when opening
the cursor does not return all the necessary rows.
Are there any known issues when running a stored procedure via an ODBC
connection?
It is not a "user rights" problem.
Sincerely,
Tobias AI'm not familiar with TCLODBC but maybe it's a problem specific to that
product. My suggestion is that you try to rewrite your code without a
cursor. Cursors are rarely necessary and almost always an inefficient
solution. Maybe if you stick to standard SQL there's a better chance that
your code will be correctly supported by TCLODBC.
David Portas
SQL Server MVP
--

Problems when running a stored procedure using a cursor via ODBC

Hello All,
This is an interesting one... I have a stored procedure on a
sql-server 2000. The procedure opens a cursor and then perform some
operations on a certain table.
When I run the procedure from a "sql query analyzer" window it works
fine, the cursor steps over all the necessary rows in the table but
when I run the procedure via ODBC (a tcl-script using "tclodbc") the
cursor behaves differently. It seems that the select used when opening
the cursor does not return all the necessary rows.
Are there any known issues when running a stored procedure via an ODBC
connection?
It is not a "user rights" problem.
Sincerely,
Tobias AI'm not familiar with TCLODBC but maybe it's a problem specific to that
product. My suggestion is that you try to rewrite your code without a
cursor. Cursors are rarely necessary and almost always an inefficient
solution. Maybe if you stick to standard SQL there's a better chance that
your code will be correctly supported by TCLODBC.
--
David Portas
SQL Server MVP
--