Showing posts with label encountered. Show all posts
Showing posts with label encountered. Show all posts

Wednesday, March 21, 2012

Error when Exporting to Excel using SSRS 2003

Hi,

I have encountered an error when attempt to open a report which is exported to Excel using SSRS2003. It looks like this:

Microsoft Office Excel File Repair Log

Errors were detected in file 'C:\Documents and Settings\TocsonEI\My Documents\Rigid\Reports\rptRigidTransactionSummaryReport3.xls'
The following is a list of repairs:

Damage to the file was so extensive that repairs were not possible. Excel attempted to recover your formulas and values, but some data may have been lost or corrupted.

At first I thought it was because of the sheer bulk of the report since when I break down a month's report to every 5 days, it would export without error. So I thought that if I can break a whole report into several worksheets using page break, it might work. Unfortunately, although I did succeed in exporting the whole report into several worksheets, I still encounter the same error. Now I have no idea on what the root of the error is. Note that the same report can be exported in other formats and can be opened without error. Except for a case when I tried opening the same report exported in XML using Excel, an error which might be related to the error above occurs which says that there's an invalid unicode character in the xml file.

Any help in determining the root of the problem and a solution to it?

Hope I can help again.

It sounds like you're hitting some of the barriers of Excel 2003. I'm trying to figure out why you have 65k + rows in a spreadsheet but I probably should not ask.

Here is a kb article that references a hotfix from ms. Are you using RS 2000? Try this or grab the latest service pack.

http://support.microsoft.com/kb/905121

also see this post if you're exporting using code.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=893165&SiteID=1

cheers,

Andrew

Monday, March 19, 2012

Error when creating a view

Hello,

I'm getting the following error when I try to excute a view against my SQL 7.0 database:

The query processor encountered an unexpected error during execution.

When I click the help button this is what I get:

An ODBC error has been generated. You might have deleted a record that has a foreign key value related to it, or you might have violated a check constraint.

The view I'm trying to create is a query between a table and another view. Here is the other view:

SELECT CSQLocation.Location_ID, CSQMeasure.Measure_ID,
CSQLocation.Location, CSQMeasure.Measure_Name
FROM CSQLocation, CSQMeasure

Here is the view that I'm getting the error on

SELECT ISNULL(CSQObjective.Objective, 0) AS Objective,
vw_getLocationMeasure.Location,
vw_getLocationMeasure.Measure_Name,
vw_getLocationMeasure.Measure_ID
FROM CSQObjective RIGHT OUTER JOIN
vw_getLocationMeasure ON
CSQObjective.Location_ID = vw_getLocationMeasure.Location_ID
AND
CSQObjective.Measure_ID = vw_getLocationMeasure.Measure_ID

Does anyone have any ideas?

Thanks,
RyanWhy you need to use the other view (getLocationMeasure)? It seems the view doesn't add any value. Why don't you just use the two original tables? Just a thought.|||The reason I'm querying a view is because I wasn't able to get the information I was needed with one query and joins. Here is a break down of my db and what I need

MEASURE TABLE
Measure_ID
Measure_Name

LOCATION TABLE
Location_ID
Location

OBJECTIVE TABLE
Objective_ID
Location_ID
Measure_ID
Objective

There are 4 measures, there are about 100 locations, and there is 1 objective per measure per location. Does that make sense? So there will be about 400 obectives in the objective table. What I was trying to do is to return all the Locations, and all the Measures even if there was not and Objective associated with them. If there are no objectives I would like to return a 0, that is where the ISNULL came from. This is the output I would like to have

LOCATION - MEASURE - OBJECTIVE
Chicago - Clean Air - 78.8
Chicago - Clean Water - 75
Chicago - Clean Dumps - 0
Chicago - Clean Roads - 0
Dallas - Clean Air - 90
Dallas - Clean Water - 70
Dallas - Clean Dumps - 25
Dallas - Clean Roads - 0

etc... Does that make sense? With all the joins I've done I have only been able to return the Locations and Measures where there is acutally a value for the Objective. I would like to return 0 if there is no objective.

Thanks
Ryan

Friday, February 24, 2012

Error trapping of datasource control

Hello,

I encountered an interesting situation. I have a gridview and a sqldatasource. It has delete function. When I delete a record an error of foreign key violation is raised. I would like to trap this error and give a user friendly message to the user.

If I use ADO.Net I can use Try/Catch, but it seems there is no way to do the same thing using datasource. Anyone knows?

Thank you,

J

void CustomersGridView_RowDeleted(Object sender, GridViewDeletedEventArgs e)
{

// Display whether the delete operation succeeded.
if(e.Exception ==null)
{
Message.Text ="Row deleted successfully.";
}
else
{
Message.Text ="An error occurredwhile attempting to delete the row.";
e.ExceptionHandled =true;
}

}

Take a look@.MSDNhttp://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdeleted.aspx
|||

Hosam,

Thank you for the reply. It helps, but I would like to get more specific message and give users a friendly message based on that. That is, how can I know the exception is raised due to foreign key violation specifically for example?

Or is there any way to trap the error message passed by a stored procedure?

Thank you,

J

|||

What about check forConstraintException

http://msdn2.microsoft.com/en-us/library/system.data(VS.71).aspx

http://msdn2.microsoft.com/en-us/library/system.data.constraintexception(VS.71).aspx

|||

That is a good suggestion. I will read them.

By the way, thinking for a little time your previous answer does not make sense. The exception is handled after row is ALREADY deleted?

|||

But note that if this exception was thrown nor record will be deleted as the constraint will prevent this.

So if the exception exists no records actually deleted.

|||

Thank you, Hosam.

I tested with detailsview's inserted event, but it did not work. However, what you were saying makes sense as well. I will look into details. If I find more new things, I wll post it here. Thank you.

J