Showing posts with label existing. Show all posts
Showing posts with label existing. Show all posts

Sunday, March 25, 2012

ASP sp execution returning closed recordset

Can anybody tell me why a) when running a stored proc from an asp page to
return a recordset the command succeeds if the sp queries an existing table
directly, but b) if the stored proc populates results into a different
table, temporary table, global temp table, or table variable, then queries
one of these, the asp page reports that the recordset object is closed. If
using a table, I have set grant, select, update, delete permissions for the
asp page user account, so it doesn't appear to be a permissioning issue. If
run in Query Analyser the sp runs fine of course.

Abridged asp code is as follows:
StoredProc = Request.querystring("SP")
oConn.ConnectionString = "Provider=SQLOLEDB etc"
oConn.Open
set oCmd = Server.CreateObject("ADODB.Command")
oCmd.ActiveConnection = oConn
oCmd.CommandText = StoredProc
oCmd.CommandType = adCmdStoredProc
oCmd.Parameters.Refresh
'code here that populates the parameters of the oCmd object correctly
Set oRs = Server.CreateObject("ADODB.Recordset")
With oRS
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockBatchOptimistic
'execute the SP returning the result into a recordset
.Open oCmd
End With
' Save data into IIS response object
Response.ContentType = "text/xml"
oRs.Save Response, adPersistXML
'the line above fails with stored procs from example B below, reporting "not
allowed when object is closed", but works with example A

SP Example A - this one works fine
Create Proc spTestA AS
SELECT ID FROM FileList
GO

SP Example B - this one doesn't work from ASP but runs fine in QA
Create Proc spTestB AS
DECLARE @.Results Table (ID TinyInt)
INSERT INTO @.Results SELECT ID FROM FileList
SELECT ID FROM @.Results
GO

I can see the SP executing using profiler when the asp page is called for
both sp's above, so it doesn't appear to be a problem with the execution.
It's something to do with returning the result set from the table variable.

Thanks,

Robin Hammond"Robin Hammond" wrote:

<snip
> SP Example B - this one doesn't work from ASP but runs fine in QA
> Create Proc spTestB AS
> DECLARE @.Results Table (ID TinyInt)
> INSERT INTO @.Results SELECT ID FROM FileList
> SELECT ID FROM @.Results
> GO

<snip
Robin,

The problem is that you're getting back a closed recordset with "records
affected" info from SQL Server: using the NextRecordset method in ADO will
get the actual recordset you're looking for. A good rule of thumb is to
watch the output from a stored proc in QA: anytime you see a resultset or a
message about records affected, then you know this could pop up.

A more efficient solution (and the one I prefer) if you don't need any data
back but the result of the SELECT is to use SET NOCOUNT...

Create Proc spTestB AS
SET NOCOUNT ON
DECLARE @.Results Table (ID TinyInt)
INSERT INTO @.Results SELECT ID FROM FileList

SET NOCOUNT OFF
SELECT ID FROM @.Results
GO

Craigsql

Sunday, March 11, 2012

AS2005: Replacing the sole data source for existing cube?

Does BI Dev Studio support (and if so, how) replacing the sole data source for an existing cube with a new data source? As a note, this new data source is really an enhanced version of the original, but with added fields, stored procedures, etc. I imagine that, if I can do what I'm asking about above, then the DSV Refresh function will either automate, or at least document, the changes needed at DSV level to keep the cube connection valid.

Question restated: DoesBI Dev Studio support (and if so, how) replacing the sole data source for an existing AS2005 cube with a new data source?

The best way to change the source of data for an existing OLAP or Data Mining object is simply to change the connection string of the Data Source object on which that object depends.After doing this, you may want to refresh the Data Source View object to confirm that the new relational source contains equivalent tables. (Right-click on the background of the DSV and choose the Refresh menu item.)

The connection string of Data Source objects is configuration dependent.This is handy as it allows you to have a single Data Source that will use one connection string when your project is in “Test” configuration and another connection string when it is in “Production” configuration. Click on the Properties menu item in the Project menu to see the active configuration and use the “Configuration Manager” button to create new configurations.

It also is possible to change the primary Data Source of a Data Source View by setting the Data Source property in the property panel.(Edit the DSV and click the background of the diagram to ensure that the DSV itself is selected.)However, changing the primary Data Source only changes the default Data Source for new tables added to the DSV.Since Data Source Views support tables from multiple Data Sources, each table already included in the DSV is associated with a specific Data Source.To change the Data Source for tables already in the DSV, you need to is replace each of the tables with an equivalent table from the Data Source of your choice (Right click on a table and choose Replace Table->With Other Table…).

Saturday, February 25, 2012

articles default

hi all, I was trying to set the articles to "delete data in the existing table that matches the row filter" in the publications "article>articles>table articles>snapshot" of the publication but everytime i reopen that property tab the publication restore to the default setting of 
"drop exisiting table and recreate it" 
i"m using sql server 2000. snapshot replication
-- thanks, joey
You can make use of dynamic snapshot to filter out the data.

Monday, February 13, 2012

ArgumentException: Font ? cannot be found.] (Asp.net Reports)

Hi guys, i have a scary problem, i have used the rdl files of an already existing reports (sql reporting services)

and succesfully converted them (to rdlc files) to asp.net local report (using reportviewer). and it works very good

on the development server,...However, it does not work completely on test(cert) server:

i actually can load the reports, except one which has graphics in it, on the other hand i can not export any of them

(even those reports that can be loaded to a page), so please help me, the point is that i have to have a pretty much of a good idea

before i go to those test server guys, i dont have access to test server myself. i get 4 exception at once, and i get them when i want to export to pdf, not just the graphic one but also all other reports. Interesting point is that the same reports (i mean the original rdl reports on sql reportingservices)

works wel on the same server (test server), that causes me to question whether it is about lack of some font on the server

i appreciate any help or idea's, and thanks:

[ArgumentException: Font '?' cannot be found.]
System.Drawing.FontFamily.GetGdipGenericSansSerif() +207809
System.Drawing.FontFamily.CreateFontFamily(String name, FontCollection fontCollection) +116
System.Drawing.FontFamily..ctor(String name, Boolean createDefaultOnFail) +13
System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style) +77
Microsoft.ReportingServices.Rendering.ImageRenderer.CanvasPDF.CreateFont(String family, Single size, FontStyle style) +54
Microsoft.ReportingServices.Rendering.ImageRenderer.CompositionBase.CreateDefaultFontPens() +33
Microsoft.ReportingServices.Rendering.ImageRenderer.CompositionPDF..ctor(CreateAndRegisterStream createAndRegisterStreamCallback, Report report) +428
Microsoft.ReportingServices.Rendering.ImageRenderer.PdfReport.RenderReport(Report report, NameValueCollection deviceInfo, EvaluateHeaderFooterExpressions evaluateHeaderFooterExpressions, CreateAndRegisterStream createAndRegisterStreamCallback, Int32 streamPageNumber) +32
Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, EvaluateHeaderFooterExpressions evaluateHeaderFooterExpressions, CreateAndRegisterStream createAndRegisterStream) +29

[ReportRenderingException: An error occurred during rendering of the report.]
Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, EvaluateHeaderFooterExpressions evaluateHeaderFooterExpressions, CreateAndRegisterStream createAndRegisterStream) +70
Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderSnapshot(IRenderingExtension renderer, CreateReportChunk createChunkCallback, RenderingContext rc, GetResource getResourceCallback) +1124

[WrapperReportRenderingException: An error occurred during rendering of the report.]
Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderSnapshot(IRenderingExtension renderer, CreateReportChunk createChunkCallback, RenderingContext rc, GetResource getResourceCallback) +1681
Microsoft.Reporting.LocalService.RenderWithDataCache(PreviewItemContext itemContext, ParameterInfoCollection reportParameters, IEnumerable dataSources, DatasourceCredentialsCollection credentials, IRenderingExtension renderer, ReportProcessing repProc, CreateAndRegisterStream createStreamCallback, ReportRuntimeSetup runtimeSetup) +1693
Microsoft.Reporting.LocalService.Render(PreviewItemContext itemContext, Boolean allowInternalRenderers, ParameterInfoCollection reportParameters, IEnumerable dataSources, DatasourceCredentialsCollection credentials, CreateAndRegisterStream createStreamCallback, ReportRuntimeSetup runtimeSetup, ProcessingMessageList& warnings) +227
Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, CreateAndRegisterStream createStreamCallback, Warning[]& warnings) +235

[LocalProcessingException: An error occurred during local report processing.]
Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, CreateAndRegisterStream createStreamCallback, Warning[]& warnings) +276
Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) +189
Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) +28
Microsoft.Reporting.WebForms.LocalReportControlSource.RenderReport(String format, String deviceInfo, NameValueCollection additionalParams, String& mimeType, String& fileNameExtension) +52
Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +153
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +202
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +303
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

Hi guys,

thanks to all poeple who took some time and read my post, i like to say that for a great

part i found the solution, the problem was that the application didnt have reading right to

the font folder of windows. we gave that right to it and it worked, at least the graphic and export to pdf works now very good, however, very strangely export to excel does not work,

when i find a solution for that too, i will sure let you guys know.

thanks,

ceti

|||

Hi guys again,

today when i started to work, for a reason that i dont know yet, the export to excel was working too..!!!

so i guess i dont know why i didnt work yesterday and why it works today..

thanks

ceti