Showing posts with label net. Show all posts
Showing posts with label net. Show all posts

Thursday, March 29, 2012

Exporting Problem in crystal reports

Hi all

I am dispalying the data in crystal reports using selection formula from table.I am using Asp.net 1.1 version.Data is coming properly according to the selection criteria. But while exporting to any format like (pdf,excel,word) irrespective of the selection formulae all the data from the table is exporting.
Can any one help me.

Regrds
Syamreply

Exporting pdf from RS to a Win Form

I'm using Reporting Services 2005 and .Net framework 2.0 and want to display
reports from RS in my Windows form. My questions are:
1) I've got the pdf from the Render-method in the RS Web Service, and tried
to display the pdf in a WebBrowser in my Windows Form using the
WebBrowser.DocumentStream property. But I don't know how set the content type
to application/pdf. I only get the binary displayed in the browser.
Suggestions?
2) If I access, from the same browser as in 1), a pdf through an URL, it
works fine. So, is if possible to retreive a report as a pdf through an URL
reference directly?
3) I could try to display the pdf some kind of other pdf container in my
winform. Does anyone know some nice tools to do this?
Regards,
Tomsi2) According to Books online for SQL Server CTP April 2005, it should be
possible to specify rs:Format=PDF as a parameter in the URL. But this doesn't
help me. It just seems to ignore the parameter... What could be wrong? Or
just simply doesn't the 2005 version support URL access directly?
"Tomsi" wrote:
> I'm using Reporting Services 2005 and .Net framework 2.0 and want to display
> reports from RS in my Windows form. My questions are:
> 1) I've got the pdf from the Render-method in the RS Web Service, and tried
> to display the pdf in a WebBrowser in my Windows Form using the
> WebBrowser.DocumentStream property. But I don't know how set the content type
> to application/pdf. I only get the binary displayed in the browser.
> Suggestions?
> 2) If I access, from the same browser as in 1), a pdf through an URL, it
> works fine. So, is if possible to retreive a report as a pdf through an URL
> reference directly?
> 3) I could try to display the pdf some kind of other pdf container in my
> winform. Does anyone know some nice tools to do this?
> Regards,
> Tomsi|||I ran into this problem as well. I need to display pdf documents
within windows forms and I am trying to utilize the webbrowser control
but can't seem to set the contenttype to 'application/pdf'. Did you
ever find a solution?
Tomsi wrote:
> I'm using Reporting Services 2005 and .Net framework 2.0 and want to display
> reports from RS in my Windows form. My questions are:
> 1) I've got the pdf from the Render-method in the RS Web Service, and tried
> to display the pdf in a WebBrowser in my Windows Form using the
> WebBrowser.DocumentStream property. But I don't know how set the content type
> to application/pdf. I only get the binary displayed in the browser.
> Suggestions?
> 2) If I access, from the same browser as in 1), a pdf through an URL, it
> works fine. So, is if possible to retreive a report as a pdf through an URL
> reference directly?
> 3) I could try to display the pdf some kind of other pdf container in my
> winform. Does anyone know some nice tools to do this?
> Regards,
> Tomsi|||1) As a temporary solution I save the pdf-stream to a file, and access the
file with the WebBrowser.Url-property:
--
string fileName = Path.GetTempFileName() + ".pdf";
FileStream fs = new FileStream(fileName, FileMode.Create);
fs.Write(bytes, 0, bytes.Length);
fs.Close();
_browserReport.Url = new Uri(fileName);
--
But I would like to know how to do this without saving to disk.
2) As far as I can read the SQL Server 2005 documentation, it should work to
get a pdf through URL access from Reporting Services by setting the attribute
"Format=PDF" in the URL. But I can't get it to work in the CTP april
2005-version.
3) Haven't tried this further out. I think Adobe sells some kind of SDK
which might help.
So my answer is that I'm still looking for a good solution.
Tomsi
"rich.beaver@.gmail.com" wrote:
> I ran into this problem as well. I need to display pdf documents
> within windows forms and I am trying to utilize the webbrowser control
> but can't seem to set the contenttype to 'application/pdf'. Did you
> ever find a solution?
> Tomsi wrote:
> > I'm using Reporting Services 2005 and .Net framework 2.0 and want to display
> > reports from RS in my Windows form. My questions are:
> >
> > 1) I've got the pdf from the Render-method in the RS Web Service, and tried
> > to display the pdf in a WebBrowser in my Windows Form using the
> > WebBrowser.DocumentStream property. But I don't know how set the content type
> > to application/pdf. I only get the binary displayed in the browser.
> > Suggestions?
> >
> > 2) If I access, from the same browser as in 1), a pdf through an URL, it
> > works fine. So, is if possible to retreive a report as a pdf through an URL
> > reference directly?
> >
> > 3) I could try to display the pdf some kind of other pdf container in my
> > winform. Does anyone know some nice tools to do this?
> >
> > Regards,
> > Tomsi
>sql

Tuesday, March 27, 2012

Exporting in SSRS 2005

Hi,

I'm developing a web app in .NET 2.0 using SSRS 2000 and 2005. Some of the reports need to be exported directly to PDF when clicked, but the problem is in the fact that the user must select the parameters from the report manager window.

Is there any way to allow the direct export to PDF when generate is clicked, or to limit the options the user has to export to in the report manager.

P.S. If it is possible, I DO NOT want to accomplish this using code.

Thanks,

Hello,

Here's how to get rid of the other export options:

Navigate to {System Root}:\Program Files\Microsoft SQL Server\MSSQL.{RS_Instance_ID}\Reporting Services\ReportServer

Open rsreportserver.config in your favorite text editor

Search for <Render>

You should see the available rendering extensions here

<Extension Name="XML" ... />

<Extension Name="EXCEL" ... />

...

In order to just have PDF available, comment out all but the line for PDF

<!-- <Extension Name="XML" ... /> -->

<!-- <Extension Name="EXCEL" ... /> -->

...

Save the file and close it

Please note, that if you do this, these options won't be available to anyone in Report Manager.

Hope this helps.

Jarret

|||Jarrett. I also had need to do this and it worked. However, I now need to restore one of the ones I had removed. I uncommented out the one I want back, saved the file, and started up Report Manager. The options under export didn't change. The uncommented one didn't reappear. Any help would be appreciated. Thanks, Jim.|||Restart your SQL Server service and ReportServer service completely. Otherwise, check if you did not accidentally make a spelling mistake or something in the Config file. Eduard

Exporting in SSRS 2005

Hi,

I'm developing a web app in .NET 2.0 using SSRS 2000 and 2005. Some of the reports need to be exported directly to PDF when clicked, but the problem is in the fact that the user must select the parameters from the report manager window.

Is there any way to allow the direct export to PDF when generate is clicked, or to limit the options the user has to export to in the report manager.

P.S. If it is possible, I DO NOT want to accomplish this using code.

Thanks,

Hello,

Here's how to get rid of the other export options:

Navigate to {System Root}:\Program Files\Microsoft SQL Server\MSSQL.{RS_Instance_ID}\Reporting Services\ReportServer

Open rsreportserver.config in your favorite text editor

Search for <Render>

You should see the available rendering extensions here

<Extension Name="XML" ... />

<Extension Name="EXCEL" ... />

...

In order to just have PDF available, comment out all but the line for PDF

<!-- <Extension Name="XML" ... /> -->

<!-- <Extension Name="EXCEL" ... /> -->

...

Save the file and close it

Please note, that if you do this, these options won't be available to anyone in Report Manager.

Hope this helps.

Jarret

|||Jarrett. I also had need to do this and it worked. However, I now need to restore one of the ones I had removed. I uncommented out the one I want back, saved the file, and started up Report Manager. The options under export didn't change. The uncommented one didn't reappear. Any help would be appreciated. Thanks, Jim.|||Restart your SQL Server service and ReportServer service completely. Otherwise, check if you did not accidentally make a spelling mistake or something in the Config file. Eduard

Exporting from snapshot data

Is there anyway possible to grab a snapshot via some vb.net or c# code and
then export it to pdf, txt, etc...?Yes,
If you've created a snapshot then you can get to the snapshot via the REnder
Method on the Reporting Services' SOAP interface.
Chapter 9¾ (Our Harry Potter Themed Chapter with Voldemort Basic.NET quips)
deals with SOAP and pages 585 - 592 - should show you all the details you
need to know about how to create a snapshot via code and also how to render
it.
Peter Blackburn
Hitchhiker's Guide to SQL Server 2000 Reporting Services
http://www.sqlreportingservices.net
"Mike H" <Mike H@.discussions.microsoft.com> wrote in message
news:62F37D51-6862-415C-9C87-FE82685FC6D3@.microsoft.com...
> Is there anyway possible to grab a snapshot via some vb.net or c# code and
> then export it to pdf, txt, etc...?sql

Exporting from MSDE to SQL Server

Hi All,

I recently created my entire site before even starting to look at hosting providers. It's a very complex ASP.NET e-Commerce site built on SQL Server. I've (nearly) got it to a point where I want it to go live.

I found a host that caters for all my needs and is a good price. What I need to do now is migrate all my data, as well as all my tables and stored procedures, into the database with my host.

Is there an easy wy to go about this?

- Mina

I would install SQL Server backup your databases and restore it in SQL Server with same name if you use the restore from Device option in the backup wizard and SQL Server will move everything for you including permissions. Then moving to the host provider will be easy because SQL Sever Enterprise Manager is needed to move your databases with most Host Companies. Hope this helps.|||You need to talk to your hosting provider -- the easiest way toaccomplish this will be to simply send them the detached MDF and LDFfiles and have the provider attach them. Whether or not they'rewilling to do that is another questionBig Smile [:D]

Thursday, March 22, 2012

Exporting Data from Database to a csv file

Hi,

How do I export data from my database table into a Comma separated value file format.

I am using SQL Server 2005 with vb.net

Thanks

you can try bcp.exe.|||It would use the SQL Server Import / Export wizard , it is more comfortable than the BCP command, although in some cases like automatic commandline export thats the only choice. Right click the database and choose the Export... command. You will be guided though a wizard for exporting.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
|||

HI baroo,

Now I have the same task but I can't find out how to do it...I also have to transfer csv to SQL,although I did it but I don't know how to export data from SQL to a csv file...

Did you solve it?If so coĂșld you also explain me how to do it?

Thanks,

Can

|||Try bcp.exe or import/export wizard, as mentioned above.|||

Hi Greg,

Thank you for the reply,I am writing a program in VB Express (SQL server express 2005) and I have to do it through coding...I tried data reader writer.writeline but it didn't work out...

Do you have an idea how can I do it using ADO or BCP but through coding....

Thanks&regards,

Can

|||

Reference SQL 2005 Books Online topic "Overview of Bulk Import and Bulk Export" for more information.

Monday, March 19, 2012

Export/Import ASP.NET Membership data

Greetings All,
I need to export/import the ASP.NET Membership data which is installed in my database via aspnet_regsql.exe. Does anyone have the Cliff notes on how to do this?

Thanks in advance.
Since this is just a set of standard SQL Server tables, you should be able to use any SSIS tool or technique to do this. The import/export wizard in SQL Server Management Studio should work just fine.|||That's what I was hoping, but unfortunetly that is not the case.

When I run the package created with the wizard specifying only the following tables:

aspnet_Users
aspnet_Applications
aspnet_Roles
aspnet_UsersInRoles
aspnet_Membership
aspnet_SchemaVersions

I get the following output:

Information: 0x4004300A at Data Flow Task, DTS.Pipeline: Validation phase is beginning.
Information: 0x4004300A at Data Flow Task, DTS.Pipeline: Validation phase is beginning.
Information: 0x40043006 at Data Flow Task, DTS.Pipeline: Prepare for Execute phase is beginning.
Information: 0x40043007 at Data Flow Task, DTS.Pipeline: Pre-Execute phase is beginning.
Information: 0x4004300C at Data Flow Task, DTS.Pipeline: Execute phase is beginning.
Information: 0x402090DF at Data Flow Task, Destination 1 - aspnet_Membership [132]: The final commit for the data insertion has started.
Information: 0x402090DF at Data Flow Task, Destination 3 - aspnet_SchemaVersions [274]: The final commit for the data insertion has started.
Information: 0x402090DF at Data Flow Task, Destination - aspnet_Applications [28]: The final commit for the data insertion has started.
Information: 0x402090DF at Data Flow Task, Destination 2 - aspnet_Roles [222]: The final commit for the data insertion has started.
Information: 0x402090DF at Data Flow Task, Destination 4 - aspnet_Users [334]: The final commit for the data insertion has started.
Error: 0xC0202009 at Data Flow Task, Destination 3 - aspnet_SchemaVersions [274]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Violation of PRIMARY KEY constraint 'PK__aspnet_SchemaVer__4316F928'. Cannot insert duplicate key in object 'dbo.aspnet_SchemaVersions'.".
Error: 0xC0202009 at Data Flow Task, Destination 2 - aspnet_Roles [222]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The INSERT statement conflicted with the FOREIGN KEY constraint "FK__aspnet_Ro__Appli__24E777C3". The conflict occurred in database "CommonPassDB", table "dbo.aspnet_Applications", column 'ApplicationId'.".
Information: 0x402090E0 at Data Flow Task, Destination 3 - aspnet_SchemaVersions [274]: The final commit for the data insertion has ended.
Information: 0x402090E0 at Data Flow Task, Destination 2 - aspnet_Roles [222]: The final commit for the data insertion has ended.
Error: 0xC0047022 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination 2 - aspnet_Roles" (222) failed with error code 0xC0202009. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
Error: 0xC0047022 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination 3 - aspnet_SchemaVersions" (274) failed with error code 0xC0202009. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_THREADFAILED. Thread "WorkThread2" has exited with error code 0xC0202009. There may be error messages posted before this with more information on why the thread has exited.
Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_THREADFAILED. Thread "WorkThread3" has exited with error code 0xC0202009. There may be error messages posted before this with more information on why the thread has exited.
Error: 0xC0202009 at Data Flow Task, Destination - aspnet_Applications [28]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "Violation of UNIQUE KEY constraint 'UQ__aspnet_Applicati__3E52440B'. Cannot insert duplicate key in object 'dbo.aspnet_Applications'.".
Error: 0xC0202009 at Data Flow Task, Destination 4 - aspnet_Users [334]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The INSERT statement conflicted with the FOREIGN KEY constraint "FK__aspnet_Us__Appli__25DB9BFC". The conflict occurred in database "CommonPassDB", table "dbo.aspnet_Applications", column 'ApplicationId'.".
Information: 0x402090E0 at Data Flow Task, Destination 4 - aspnet_Users [334]: The final commit for the data insertion has ended.
Information: 0x402090E0 at Data Flow Task, Destination - aspnet_Applications [28]: The final commit for the data insertion has ended.
Error: 0xC0202009 at Data Flow Task, Destination 1 - aspnet_Membership [132]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The statement has been terminated.".
An OLE DB record is available. Source: "Microsoft SQL Native Client" Hresult: 0x80004005 Description: "The INSERT statement conflicted with the FOREIGN KEY constraint "FK__aspnet_Me__Appli__178D7CA5". The conflict occurred in database "CommonPassDB", table "dbo.aspnet_Applications", column 'ApplicationId'.".
Error: 0xC0047022 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination 4 - aspnet_Users" (334) failed with error code 0xC0202009. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
Information: 0x402090E0 at Data Flow Task, Destination 1 - aspnet_Membership [132]: The final commit for the data insertion has ended.
Error: 0xC0047022 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - aspnet_Applications" (28) failed with error code 0xC0202009. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_THREADFAILED. Thread "WorkThread4" has exited with error code 0xC0202009. There may be error messages posted before this with more information on why the thread has exited.
Error: 0xC0047022 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination 1 - aspnet_Membership" (132) failed with error code 0xC0202009. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_THREADFAILED. Thread "WorkThread0" has exited with error code 0xC0202009. There may be error messages posted before this with more information on why the thread has exited.
Error: 0xC0047021 at Data Flow Task, DTS.Pipeline: SSIS Error Code DTS_E_THREADFAILED. Thread "WorkThread1" has exited with error code 0xC0202009. There may be error messages posted before this with more information on why the thread has exited.
Information: 0x40043008 at Data Flow Task, DTS.Pipeline: Post Execute phase is beginning.
Information: 0x402090DF at Data Flow Task, Destination 5 - aspnet_UsersInRoles [387]: The final commit for the data insertion has started.
Information: 0x402090E0 at Data Flow Task, Destination 5 - aspnet_UsersInRoles [387]: The final commit for the data insertion has ended.
Information: 0x40043009 at Data Flow Task, DTS.Pipeline: Cleanup phase is beginning.
Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "Destination - aspnet_Applications" (28)" wrote 1 rows.
Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "Destination 1 - aspnet_Membership" (132)" wrote 1 rows.
Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "Destination 2 - aspnet_Roles" (222)" wrote 1 rows.
Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "Destination 3 - aspnet_SchemaVersions" (274)" wrote 3 rows.
Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "Destination 4 - aspnet_Users" (334)" wrote 1 rows.
Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "Destination 5 - aspnet_UsersInRoles" (387)" wrote 0 rows.
Task failed: Data Flow Task
SSIS package "Package1.dtsx" finished: Failure.
The program '[5340] Package1.dtsx: DTS' has exited with code 0 (0x0).

Has anyone ever tried this before?

Thanks.
|||You need to ensure that you're running the packages in the correct order, so that the foreign key constraints aren't violated.|||The wizard creates a single package containing a single Data Flow Task. Inside the Data Flow Task is a pair of OLEDB Source and Destination Data Flow Sources. How do I control the order in which the OLEDB "pairs" execute?

Must I break each one of these out into its own Data Flow Task?
|||Yes. This default configuraion is running them in parallel; you need them to run in a specific serial order based on the FKs defined in the database, which cannot be done in a single data flow.|||Ok, thanks. That did it.

I appreciate your help.

|||Thanks for the feedback - good luck!

export with a webservice

Hi,
I have created an application with VIsual Studio.NET in C#. I used a
webservice in order to view my reports.
I want export my report in format that I want with this application.
How can I do? What is the solution?I've done this by putting into a dropdownlist the available export formats
for a particular report. then when i go to render the report i have the
following code:
try
{
report =rs.Render(reportPath,format,historyID,devInfo,parameters,credentials,showHideToggle,out
encoding, out mimeType, out optionalParams, out optionalWarnings, out
streamIDs);
switch(format)
{
case "PDF":
Response.ClearContent();
Response.AppendHeader("content-length", report.Length.ToString());
Response.ContentType = "application/pdf";
Response.BinaryWrite(report);
Response.Flush();
Response.Close();
break;
case "CSV":
Response.ClearContent();
Response.AppendHeader("content-length", report.Length.ToString());
Response.ContentType = "application/vnd.ms-excel";
Response.BinaryWrite(report);
Response.Flush();
Response.Close();
break;
case "EXCEL":
Response.ClearContent();
Response.AppendHeader("content-length", report.Length.ToString());
Response.ContentType = "application/vnd.ms-excel";
Response.BinaryWrite(report);
Response.Flush();
Response.Close();
break;
default:
Label1.Text = System.Text.Encoding.Default.GetString(report);
break;
}
}
catch (SoapException se)
{
Console.WriteLine(se.Detail.OuterXml);
}
"r388042" wrote:
> Hi,
> I have created an application with VIsual Studio.NET in C#. I used a
> webservice in order to view my reports.
> I want export my report in format that I want with this application.
> How can I do? What is the solution?|||Thanks you!!!
It's run very good!!!
Do you know how we can do in order to export in XML or TIFF?

Export window does not close

Report Server 2005; .NET framework 2.0; IE 6.0

I view a report in Report Manager, then I click the drop-down box and select an output type, select Save, and a new blank web page opens, then the small export window opens asking for the filename. The file is created, then I close the export window, but the blank web page window does not close. I can see that the web page showing my original view of the report is still open, but I have to close the blank web page myself. While not really an error, this is an annoyance for users. Is there a setting that will help prevent this problem? Is this a bug?

Thanks for any help.

Getting same problem as mentioned by DawnJ..

i want to rectify this problem as soon as possible..Reply back friends if u have relevant information for this thread...

Thanks in Advance

Bhoopathi...

Export window does not close

Report Server 2005; .NET framework 2.0; IE 6.0

I view a report in Report Manager, then I click the drop-down box and select an output type, select Save, and a new blank web page opens, then the small export window opens asking for the filename. The file is created, then I close the export window, but the blank web page window does not close. I can see that the web page showing my original view of the report is still open, but I have to close the blank web page myself. While not really an error, this is an annoyance for users. Is there a setting that will help prevent this problem? Is this a bug?

Thanks for any help.

Getting same problem as mentioned by DawnJ..

i want to rectify this problem as soon as possible..Reply back friends if u have relevant information for this thread...

Thanks in Advance

Bhoopathi...

Wednesday, March 7, 2012

Export to Exel

I am newbie in exporting data.

i am using visual studio.net 2003 and using vb.net to create a webapplication.

My problem is how do i query my data from MS-SQL and export to microsoft Exel??

Can some one gave me the sample code?

Thanks

I had success to export my data to exel,

but why must i save the file before i open it??

Can anyone help me solve this problem??

My coding is Below :

Dim

rAsNew Columnar_Landed

r.SetDatabaseLogon("username", "password", "192.xxx.xxx.xxx,xx", "DTZ-VMS")

r.RecordSelectionFormula = query

Dim oStreamAsNew MemoryStream

oStream = r.ExportToStream(CrystalDecisions.Shared.ExportFormatType.ExcelRecord)

HttpContext.Current.Response.Clear()

HttpContext.Current.Response.Buffer =

True

HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"

HttpContext.Current.Response.BinaryWrite(oStream.ToArray())

HttpContext.Current.Response.End()

|||

Please search the forum. You will find a lot of material on it. Search by "Gridview to excel". one important link is:

http://forums.asp.net/thread/1573815.aspx

Please mark this post as resolved if you r done

Sunday, February 26, 2012

Export to Excel -multiple sheets

Hi,

I am using .rdlc report in ASP.NET 2.0.

My report consists of 10 subreport and 1 main report. I want to export each subreport in separate sheets like Shee1 is Subreport1 and Sheet2 is Subreport2 etc... How can i do this.

Thanks.

The Excel renderer creates new worksheet tabs for each page in your report. To get a new page for each Subreport, put each of them inside a Rectangle and set PageBreakAtStart on the Rectangle to True.

-Chris

|||

I haven't been able to get the sub reports to show when exported to excel. Is there a trick to this?

Dwayne

|||

This works for me. However, what does not work, is using a subreport in a cell of a table and export that to Excel.

Regards, Jeroen

Export to Excel -multiple sheets

Hi,

I am using .rdlc report in ASP.NET 2.0.

My report consists of 10 subreport and 1 main report. I want to export each subreport in separate sheets like Shee1 is Subreport1 and Sheet2 is Subreport2 etc... How can i do this.

Thanks.

The Excel renderer creates new worksheet tabs for each page in your report. To get a new page for each Subreport, put each of them inside a Rectangle and set PageBreakAtStart on the Rectangle to True.

-Chris

|||

I haven't been able to get the sub reports to show when exported to excel. Is there a trick to this?

Dwayne

|||

This works for me. However, what does not work, is using a subreport in a cell of a table and export that to Excel.

Regards, Jeroen

|||Hi, related to Jeroen's Question...
"This works for me. However, what does not work, is using a subreport in a cell of a table and export that to Excel."

As a solution for this problem, we can have a rectangle within the table and place the subreport inside it, it allows to export. There is again few limitaions further but at least we can export the data of the subreport. Hope this helps.

Export to Excel -multiple sheets

Hi,

I am using .rdlc report in ASP.NET 2.0.

My report consists of 10 subreport and 1 main report. I want to export each subreport in separate sheets like Shee1 is Subreport1 and Sheet2 is Subreport2 etc... How can i do this.

Thanks.

The Excel renderer creates new worksheet tabs for each page in your report. To get a new page for each Subreport, put each of them inside a Rectangle and set PageBreakAtStart on the Rectangle to True.

-Chris

|||

I haven't been able to get the sub reports to show when exported to excel. Is there a trick to this?

Dwayne

|||

This works for me. However, what does not work, is using a subreport in a cell of a table and export that to Excel.

Regards, Jeroen

Export to Excel Link - Inactive -Critical - Need Help

Hi all,
I am using asp.net control(Reportviewer) to view the report in the web, but
when I render the report, the export link is inactive and when I choose the
refresh button, the Export link is activated.
For the first time the Export link button is inactive.
This issue is very critical, please need your help
Thanks
Balaji
--
Message posted via http://www.sqlmonster.comCan anyone answer this.
Balaji
--
Message posted via http://www.sqlmonster.com

Export to Excel Functionality (SQL RS 2005)?

Hi there,
We have an ASP.NET 2.0 application that we are currently using and
would like to tie in some SQL RS 2005 functionality. Specifically,
we'd like to be able to use the report exporting functionality to
generate Excel or Acrobat docs, without having to use the report
viewer or using Reporting Services to generate a report in any way
that would be sent to the client. In other words, we don't want
reporting services to display the report on the site in any way, we
just want it to return the doc type selected from a drop down list.
Is this possible?
Thanks in advance,
RichReporting services is built totally on web services. This is used by
everything you see. For instance, Report Manager (the portal that ships with
RS uses it). In 2005 the reportviewer control uses it. It is totally
documented and you can use it in your app and render to whatever format you
like (html, csv, excel, pdf etc). You stream it back to your app and then do
with it as you please.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"rchung77" <rich.chung@.gmail.com> wrote in message
news:1186758560.748324.102890@.e9g2000prf.googlegroups.com...
> Hi there,
> We have an ASP.NET 2.0 application that we are currently using and
> would like to tie in some SQL RS 2005 functionality. Specifically,
> we'd like to be able to use the report exporting functionality to
> generate Excel or Acrobat docs, without having to use the report
> viewer or using Reporting Services to generate a report in any way
> that would be sent to the client. In other words, we don't want
> reporting services to display the report on the site in any way, we
> just want it to return the doc type selected from a drop down list.
> Is this possible?
> Thanks in advance,
> Rich
>

Wednesday, February 15, 2012

Export sql data to text file

Hi all,

I am new to ssis. I try to create a package completely by vb.net to export a table in sql server to text file. i got the following error while i run the package,

An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft OLE DB Provider for ODBC Drivers"
Hresult: 0x80004005 Description: "[Microsoft][ODBC Driver Manager]
Data source name not found and no default driver specified".
The AcquireConnection method call to the connection manager "OLEDBSrc"
failed with error code 0xC0202009.
component "OLE DB Source" (1) failed validation and returned error code 0xC020801C.
One or more component failed validation.
There were errors during task validation.

i have posted my code below,

Dim pkg As New Package

Dim OLEDBConMgr As ConnectionManager

Dim FileConMgr As ConnectionManager

Dim SrcComponent As IDTSComponentMetaData90

Dim SrcInstance As CManagedComponentWrapper

Dim DesComponent As IDTSComponentMetaData90

Dim DesInstance As CManagedComponentWrapper

pkg.PackageType = DTSPackageType.DTSDesigner90

Dim e As Executable = pkg.Executables.Add("DTS.Pipeline.1")

Dim thMainPipe As TaskHost = e 'as Task Host

Dim DataFlowTask As MainPipe = thMainPipe.InnerObject 'as MainPipe

'OLEDB Connection Manager

OLEDBConMgr = pkg.Connections.Add("OLEDB")

OLEDBConMgr.ConnectionString = "Data Source=srcServerName;Initial Catalog=srcDBName;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Auto Translate=False;"

OLEDBConMgr.Name = "OLEDBSrc"

OLEDBConMgr.Description = "OLEDB Connection to flightinfo database"

'FlatFile Connection Manager

FileConMgr = pkg.Connections.Add("FLATFILE")

FileConMgr.ConnectionString = "//FilePath"

FileConMgr.Name = "FLATFILE"

FileConMgr.Description = "Flat File Connection to the file"

FileConMgr.Properties("DataRowsToSkip").SetValue(FileConMgr, 0)

FileConMgr.Properties("Format").SetValue(FileConMgr, "Delimited")

FileConMgr.Properties("ColumnNamesInFirstDataRow").SetValue(FileConMgr, False)

FileConMgr.Properties("Unicode").SetValue(FileConMgr, False)

FileConMgr.Properties("RowDelimiter").SetValue(FileConMgr, vbCrLf)

FileConMgr.Properties("TextQualifier").SetValue(FileConMgr, "<none>")

FileConMgr.Properties("HeaderRowsToSkip").SetValue(FileConMgr, 0)

FileConMgr.Properties("HeaderRowDelimiter").SetValue(FileConMgr, vbCrLf)

FileConMgr.Properties("CodePage").SetValue(FileConMgr, 1252)

'Create Source Component

SrcComponent = DataFlowTask.ComponentMetaDataCollection.[New]

SrcComponent.ComponentClassID = "DTSAdapter.OLEDBSource"

SrcComponent.Name = "OLEDB"

'Get the Design time instance of the component

SrcInstance = SrcComponent.Instantiate

'Initialize the component

SrcInstance.ProvideComponentProperties()

'Specify the Connection Manager

If SrcComponent.RuntimeConnectionCollection.Count > 0 Then

SrcComponent.RuntimeConnectionCollection(0).ConnectionManagerID = OLEDBConMgr.ID

SrcComponent.RuntimeConnectionCollection(0).ConnectionManager = DtsConvert.ToConnectionManager90(OLEDBConMgr)

End If

'Set the Custom Properties

SrcInstance.SetComponentProperty("AccessMode", 0)

SrcInstance.SetComponentProperty("OpenRowset", "[dbo].[srcTableName]")

'ReInitialize the metadata

'SrcInstance.AcquireConnections(Nothing)

'SrcInstance.ReinitializeMetaData()

'SrcInstance.ReleaseConnections()

'Create Destination Component

DesComponent = DataFlowTask.ComponentMetaDataCollection.[New]

DesComponent.ComponentClassID = "DTSAdapter.FlatFileDestination"

DesComponent.Name = "FLATFILE"

'Get the Design time instance of the component

DesInstance = DesComponent.Instantiate

'Initialize the component

DesInstance.ProvideComponentProperties()

'Specify the Connection Manager

If DesComponent.RuntimeConnectionCollection.Count > 0 Then

DesComponent.RuntimeConnectionCollection(0).ConnectionManagerID = FileConMgr.ID

DesComponent.RuntimeConnectionCollection(0).ConnectionManager = DtsConvert.ToConnectionManager90(FileConMgr)

End If

'ReInitialize the metadata

'DesInstance.AcquireConnections(Nothing)

'DesInstance.ReinitializeMetaData()

'DesInstance.ReleaseConnections()

Dim path As IDTSPath90 = DataFlowTask.PathCollection.[New]

path.AttachPathAndPropagateNotifications(SrcComponent.OutputCollection(0), DesComponent.InputCollection(0))

' Get the destination's default input and virtual input.

Dim input As IDTSInput90 = DesComponent.InputCollection(0)

Dim vInput As IDTSVirtualInput90

vInput = input.GetVirtualInput()

'Iterate through the virtual column collection.

Dim vColumn As IDTSVirtualInputColumn90

' Iterate through the virtual input column collection.

For Each vColumn In vInput.VirtualInputColumnCollection

' Call the SetUsageType method of the destination

' to add each available virtual input column as an input column.

DesInstance.SetUsageType(input.ID, vInput, vColumn.LineageID, DTSUsageType.UT_READONLY)

Next

' Verify that the columns have been added to the input.

For Each inputColumn As IDTSInputColumn90 In DesComponent.InputCollection(0).InputColumnCollection

MsgBox(inputColumn.Name)

Next

Dim pkgResult As DTSExecResult

pkgResult = pkg.Execute

Is there anybody know it? plz help me.

regards,

sivani

OLEDBConMgr.ConnectionString = "Data

Source=srcServerName;Initial

Catalog=srcDBName;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist

Security Info=False;Auto Translate=False;"


Might be something with your connection string, Try:

"Data Source=srcServerName;Initial Catalog=srcDBName;Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False;"|||

I changed the connection string but still i got the same error and in path creation,

Dim path As IDTSPath90 = DataFlowTask.PathCollection.[New]

path.AttachPathAndPropagateNotifications(SrcComponent.OutputCollection(0), DesComponent.InputCollection(0))

the following error occured at the endpoint while debugging

ErrorCode = -2147467259
Error HRESULT E_FAIL has been returned from a call to a COM component.

|||

Thanks a lot.

The connection string is the problem. i corrected the error but in flat file validation i got the following error, i think its related with column mapping but i dont know abt it. plz help me. the error is,

"component "FLATFILE" (31)" failed validation and returned validation status "VS_NEEDSNEWMETADATA".

One or more component failed validation.

There were errors during task validation.

|||

Hi,

Anybody has any idea to solve the "VS_NEEDNEWMETADATA" problem.

thanks

sivani.

|||What is the VS_NEEDNEWMETADATA problem?|||

Hi,

I already posted the problem in,

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

plz find it.

thanks

Sivani

|||

You are correct, the problem is related to the column mappings.

There are no external columns created in the above post for the flat file destination, nor are there any mapping to those columns. Hence, there is nothing to map the oledb sourced input columns into.

See the example (if you've downloaded the 2005 Samples) located by default at "%ProgramFiles%\Microsoft SQL Server\90\Samples\Integration Services\Programming Samples\Control Flow\CreatePackage Sample\VB" which does exactly what you're attempting here. The sample is a programmatic package builder which instantiates an OLEDB source that ends up in a flat file destination.

|||

Hi,

Thanks for ur suggestion. i solved the problem.

Thanks & Regards,

Sivani

export report to another SQL server running Rep services ?

SETUP
ME: internally I have sql server, vs.net 2003, iis5, sql reporting services
setup on a machine.
SITE2: site 2 has sql server, iis5, reporting services.
On my interternal machine i create an ASP report using SQL reporting
services report designer.
How do i transfer this report and get it working on site3 ?
i would have to change the sql connection string i assume ?
Thanks
Scottthink i just found out how is works i.e upload the report file and give it
connection string.