Showing posts with label request. Show all posts
Showing posts with label request. Show all posts

Tuesday, March 27, 2012

Easy SQL syntax question

Dim varBookID as String
varBookID = request.params("BookID")

Dim varBookNo as String
varBookNo = request.params("BookNo")

***What is incorrect with the string concatenation below? I know the SQL syntax is incorrect, but i cannot locate the problem.***

DBCommand = New OleDbDataAdapter("SELECT * FROM Books WHERE BookID=" & "'" & varBookID & "'" AND BookNo= & "'" & varBookNo & "'"", DBConn)

You have a string with a part that ends after

"SELECT * FROM Books WHERE BookID=" & "'" & varBookID & "'"

Then comes

AND BookNo= & "'" & varBookNo & "'""

That should give you a compiler syntax error right there. Simplified:

"SELECT * FROM Books WHERE BookID='" & varBookID & "' AND BookNo='" & varBookNo & "'"

Among other things, it is because of stuff like this that you should use
Stored procedures and SqlParameters, which eliminate these kinds of tedious string concatenations.
You can find many examples on the net

|||It looks like you've got an extra quote mark at the end.
sql

Monday, March 26, 2012

Easy method of Forms Authentication

Does anybody know if it is possible to create an ASP.NET webform (Form1)
that simply recieves a request from a client browser, and then sends that
request (changing a few bits as necessary) on to another page (Form2). The
response from Form2 will then be digested by Form1 and returned to client
browser.
I know that Server.Transfer has limitations, in that it only works between
ASPX forms, but this would be a great way of getting around all of the
Authentication problems in Report Services and sounds really easy.
You would just have to add some credentials, parameters if required and hey
presto, your in.
There may be a bit of a complicated conversation on the way through - but
this cant be as difficult as all the stuff that is going on here for
integeration.
Please somebody either add there support for this issue, or answer it as it
would solve loads of peoples issues.
Thanks in advance.
--
Message posted via http://www.sqlmonster.comThe Forms Authentication sample code provided by Microsoft is about as easy
as it can get for integrating with Reporting Services. We have used this as
a starting point to integrate with our own ASP.NET applications and
single-sign-on solution. If you have questions about this, please feel free
to post back.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"Tom Robson via SQLMonster.com" <forum@.SQLMonster.com> wrote in message
news:47c0624d6e254541b1877708761a9ea9@.SQLMonster.com...
> Does anybody know if it is possible to create an ASP.NET webform (Form1)
> that simply recieves a request from a client browser, and then sends that
> request (changing a few bits as necessary) on to another page (Form2). The
> response from Form2 will then be digested by Form1 and returned to client
> browser.
> I know that Server.Transfer has limitations, in that it only works between
> ASPX forms, but this would be a great way of getting around all of the
> Authentication problems in Report Services and sounds really easy.
> You would just have to add some credentials, parameters if required and
> hey
> presto, your in.
> There may be a bit of a complicated conversation on the way through - but
> this cant be as difficult as all the stuff that is going on here for
> integeration.
> Please somebody either add there support for this issue, or answer it as
> it
> would solve loads of peoples issues.
> Thanks in advance.
> --
> Message posted via http://www.sqlmonster.com

Wednesday, March 21, 2012

Dynamicalt changing sql query in crystal sub report

I m using Crystal 8.5 with VB6.
i had make sql change in main report
but
How to make to send a SQL request for the subreport ?
IreshMoved to a more proper forum|||Open the subreport and change the query that you want

Sunday, March 11, 2012

Dynamically Created Stored Procs??

Okay. Scenario:

We as a company have several companies that request custom reports from us. However, the custom reports that they select will generally always have the same fields (and formulas) once they make up their minds on what works for them.

From what I know, Stored Procs are usually faster at running things unless the parameters are changing too drastically that they get passed.

This being the case, it would seem like a good case for creating a stored proc per report. This would alleviate the possability that the server chooses an execution plan that works great some of the time but the rest of the time run lousy.

So these thoughts being laid out, is there a good,nice,easy, convenient way to generate/alter a stored proc, either by another stored/extended proc, or by dynamic sql going to the server?

Or if not, is there some round-about yet effective way of doing this?

Thank you in advance for any help.
-ZanderBI guess I don't understand why you feel you need to be able to alter existing stored procedures on demand. Automating something like this would take a lot more programming skill and development time than just copying an existing procedure and modifying it to create a new one.|||The point of the matter is that right now, there is no efficient on demand procedure (that I know of). Any dynamic SQL must rely on having an execution plan made by the server every time (as I understand).

When you have web enabled reports that already take several minutes, it becomes key that optimizations are made. At the same time, having something that is dynamic, but generally used enough to say it's called all the time is something that would be worthy of being called by a stored proc. Perhaps even something equivical would be nice that is not as static, but there is nothing I know of that does that for dynamic SQL.

If you had a web server that server for 4 items 80% of the time, but those 4 items changed frequently (like once a week) you could say there would be a good argument for something like this, could you not?

The structure of the where statement can cause the execution plan to be changed.

So my question again is why you wouldn't want a dynamically created stored proc for this.

Are dynamic queries going to have a cached execution plan if the same ones are called enough?|||When the procedure is supposed to be used only once, it is perhaps not a good idea to create the procedure and the drop it after having executed it once.

Another approach that i have tried, is to create what is called an anonymous block. This is the body of the procedure without the create procedure part. This is a T-sql block that is sent to the database and executed as if it where a straight forward select. It can contain exeption handling and give all the functionality you expect from a procedure, but will not impact the system dictionary. The overhead will probably be less than the procedure approach since the system dictionary is not updated.

n both cases you will get one parse, optimize, compile and execute. The database will perform it as optimal as a procedure. I have tried it with code performaing a cursor loop and doing a couple of queries for each row in the cursor. This is code that is much better to perform inside the database than from an external application.|||Nevermind. It is possible through a standard connection to the server (with right permissions) to change/add stored procs. I didn't know if this was a possibility or not. It only surprises me that noone said it's possible with dynamic SQL statements.|||Originally posted by ZanderB
When you have web enabled reports that already take several minutes

Every new request becomes a log of the report in a table.

The get a list and select what they want... the table stores the proc name which gets executed

You'll come to a point when you've created almost all variations.

And if you're telling us that you have to wait several minutes for a web based report...that's waaaaaaaaaaaaaaaaaaaay too long

You need to build a process to denormalize the data so they pop...

I would imagine an in/experienced user would think the damn thing is broken...|||Originally posted by ostrande
anonymous block.

Don't look now...but your Oracle is showing...

:D|||No one said it was possible with dynamic SQL because no one wants to recommend dynamic SQL. Dynamic SQL is usually slower and less efficient, although admittedly in some cases where there are complex conditions dynamic SQL can be faster. In these cases, though, the dynamic SQL is best created and executed within the procedure given the parameters supplied. The procedure itself is not modified.

And bear in mind that having a pre-compiled stored procedure does save execution time - like 1 or 2 seconds (at the most!) for each time the procedure is executed. It does not take that long for SQL server to compile a procedure. If your querys are taking 3-4 minutes, the problem is not in the compilation time.|||Yo, Blind dude...

ever wait MINUTES for a web based report?

Sunday, February 26, 2012

Dynamic way to change font, font size, etc. in reports

Hi,
I have one report format for many clients. Some of them request different
fonts and font sizes. I don't want to duplicate reports because of differnt
fonts. Is there a dynamic way to change font or font size using only one
report format? Thanks.
ChuckChuck,
Custom code either embedded or as a custom assembly is the answer. This
article is a good starting point. http://odetocode.com/Articles/130.aspx.
Also, refer to the BOL for using custom assemblies.
You can use custom code to set font properties in your report.
"Chuck" wrote:
> Hi,
> I have one report format for many clients. Some of them request different
> fonts and font sizes. I don't want to duplicate reports because of differnt
> fonts. Is there a dynamic way to change font or font size using only one
> report format? Thanks.
>
> Chuck