The .NET Knowledge Sharing Thread

Status
Not open for further replies.

dequadin

Expert Member
Joined
May 9, 2008
Messages
1,434
UPDATE:
I've recently updated the contents and links on a few of the sections, as well as adding a couple of new ones. Thanks for the input guys!
Please report any broken likes to me via PM



.NET Knowledge Sharing Thread.

I often come across good tutorials, blogs and the like and often post them here, so instead of creating a new thread each time now there will be one place for them all. This is a knowledge sharing thread and not a how-to or please help me thread, lets try and keep it that way please. Also please do not quote my posts that contain links to articles (etc) and these will change over time and mess up the thread, the same goes for the grammar nazi's.

Most of the stuff will probably be C# related, not that it matters since it's easily converted to VB.NET check out any of these:

Contents

If you've come here looking for something and you don't find it, please try and search for yourself, and don't post your problems here there's a whole forum for that.
 
Last edited:

FarligOpptreden

Executive Member
Joined
Mar 5, 2007
Messages
5,396
Awesome idea for a thread. The interest and willingness of users to share would dictate its success though...
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
Awesome idea for a thread. The interest and willingness of users to share would dictate its success though...

www.gotreportviewer.com; that is about what i have to share for now as i'm doing a ****load of custom reports via rdlc at bosses command (and no nice nice xml way round it like i know you would suggest :D)

ReportViewer is a freely redistributable control that enables embedding reports in applications developed using the .NET Framework. Reports are designed with drag-and-drop simplicity using Report Designer included in Visual Studio 2008 (Standard editon and above.)

See screenshots of some applications that have ReportViewer control embedded in them.

The ReportViewer control offers the following benefits:

* Processes data efficiently. The reporting engine built into ReportViewer can perform operations such as filtering, sorting, grouping and aggregation.
* Supports a variety of ways in which to present data. You can present data as lists, tables, charts and matrices (also known as crosstabs.)
* Adds visual appeal. You can specify fonts, colors, border styles, background images etc to make your report visually appealing.
* Enables interactivity in reports. You can have collapsible sections, document map, bookmarks, interactive sorting etc in your report.
* Supports conditional formatting. You can embed expressions in the report to change display style dynamically based on data values.
* Supports printing and print preview.
* Supports export to Excel and PDF.

The control can process and render reports independently using a built-in engine ('local mode') or it can display reports that are processed and rendered on a Report Server ('remote mode').

There is a WinForms and a WebForms version of the control.
 

dequadin

Expert Member
Joined
May 9, 2008
Messages
1,434
Awesome idea for a thread. The interest and willingness of users to share would dictate its success though...

Very true, that why you web dev guys (ASP.NET) also need to contribute as I know _nothing_ in that field. Luckly I have a very large bookmark collection as I'm a self taught .NET developer off the interwebs, so I have a decent amount to contribute.
 
Last edited:

FarligOpptreden

Executive Member
Joined
Mar 5, 2007
Messages
5,396
I'll see if I can find a few interesting resources to share. I very rarely save a bookmark of articles I read. When I struggle to do something in ASP.NET or C#, I search for help, follow said advice and memorize the solution for future use. I never read the same article twice.
 

guest2013-1

guest
Joined
Aug 22, 2003
Messages
19,804
www.gotreportviewer.com; that is about what i have to share for now as i'm doing a ****load of custom reports via rdlc at bosses command (and no nice nice xml way round it like i know you would suggest :D)

That's not really new but thanks for sharing. A lot of people fall into the trap that they need a web server for that. FYI, only caveat I had when working with that is that you need to know how to setup and process your own dataset's (and most programmers I've shown the offline reporting tool couldn't really grasp it... :rolleyes: )
 

Necuno

Court Jester
Joined
Sep 27, 2005
Messages
58,567
That's not really new but thanks for sharing. A lot of people fall into the trap that they need a web server for that. FYI, only caveat I had when working with that is that you need to know how to setup and process your own dataset's (and most programmers I've shown the offline reporting tool couldn't really grasp it... :rolleyes: )

i really don't have anything ZOMG as its just the normal boring maintenance and or duplication, besides most "new" things i read comes via RSS ;)
 

FarligOpptreden

Executive Member
Joined
Mar 5, 2007
Messages
5,396
Not necessarily .NET related, but SQL Server 2005+ related:

If you every tried to join a table to a table-valued function and got the exception "Multi-part identifier xx.xx not found" (or similar :p) there is still hope in the form of CROSS / OUTER APPLY. So, your initial query that looked something like:
Code:
SELECT
    TB.PK_Field,
    TB.Value_Field_1,
    TB.Value_Field_2,
    FX.Calculated_Field_A,
    FX.Calculated_Field_B
FROM SomeTable TB 
    INNER JOIN SomeFunction(TB.PK_Field) FX ON 1 = 1

...would now look something like:
Code:
SELECT
    TB.PK_Field,
    TB.Value_Field_1,
    TB.Value_Field_2,
    FX.Calculated_Field_A,
    FX.Calculated_Field_B
FROM SomeTable TB 
    CROSS APPLY SomeFunction(TB.PK_Field) FX

The difference between CROSS APPLY and OUTER APPLY is that CROSS APPLY acts as an INNER JOIN (returning only rows with non-null values resulting from the function), where the OUTER APPLY acts as a LEFT JOIN (returning rows even if the function results in null values).

This took me a good 2 hours to figure out, with INNER, LEFT and CROSS joins all thrown into the mix. I even tried views to simulate what I wanted, but couldn't get the correct results. So, to anyone struggling with a similar problem, CROSS or OUTER APPLY is the answer!

Hope this little info session helps...
 

dequadin

Expert Member
Joined
May 9, 2008
Messages
1,434
SQL Related


Tools
  • sqlmap
    sqlmap is an open source automatic SQL injection tool. It is able to detect and exploit SQL injections and allows the user to enumerate data from the database, execute commands on the operating system, establish an out-of-band connection and much more.
 
Last edited:

FarligOpptreden

Executive Member
Joined
Mar 5, 2007
Messages
5,396
Right, lets hope the right person with the correct permissions responds to my humble little request... :p

EDIT: W00t! It's done!
 
Last edited:

FarligOpptreden

Executive Member
Joined
Mar 5, 2007
Messages
5,396
Export data to Office 2007's XML-based formats:

Right, so you, like many other developers, have grown sick and tired of using the terrible (and mostly redundant) Office Interop APIs to create Excel and Word documents from your precious data... There is a solution in the form of OpenXML. If you didn't know it already, all Office 2007 XML-based documents are essentially an archived file filled with XML files. Don't believe it? Try renaming any .docx or .xlsx file to .zip and extract the contents to a folder. Ta-dah! Study the directory and file structure a bit, especially the .rels files, which indicate the relationship of all the files in the archive.

So, a more scalable solution to exporting Excel and Word files in the Office 2007 XML format, is to build up the necessary XML files in the correct directory structure, zip them up and rename to .docx or .xlsx (depending on the type of document you just created, obviously :p). By conforming to the different Markup Languages specified in the OpenXML framework (i.e. WordML for Word Documents and SpeadsheetML for Excel Spreadsheets) you can easily export any of the data in your application to document formats that business users are constantly badgering you for...

You might be wondering how on earth you are going to zip up the files from C#, right? Have a look at the SharpZipLib .NET Zip Library. It works wonders.

So, what's the best thing about this solution? You don't need Office installed on the client or server computer! You might be concerned about the fact that about 75% of your target market might still be stuck on Office 2003, right? Well, that's not necessarily a problem anymore... Just redirect the users here and they will be basking in the OpenXML document glory in no time!
 
Last edited:

FarligOpptreden

Executive Member
Joined
Mar 5, 2007
Messages
5,396
I'll see if I can dig up some resources for WinForms on creating custom-look menus. Struggled with it a few years ago and it's bound to be useful to someone...
 
Status
Not open for further replies.
Top