<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4534665907494175367</id><updated>2012-02-08T12:41:02.932-05:00</updated><category term='ISNULL()'/><category term='database fields in report header footer rdlc reportviewer localreport'/><category term='embedded'/><category term='reportviewer rdlc pdf .net localreport'/><category term='ssrs'/><category term='images external database embeded localreport reportviewer'/><category term='SQL'/><category term='reporting services'/><category term='custom code'/><category term='COALESCE()'/><category term='customize reportviewer messages render excel hide toolbar localreport'/><category term='format data dynamically'/><category term='dat driven subscription'/><category term='empty reports'/><category term='NULLIF'/><category term='format date time year telephone String'/><category term='ISNULL'/><category term='sql reporting'/><category term='reporting'/><title type='text'>technoblab</title><subtitle type='html'>SQL Server, Reporting Services</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-3091042813475426806</id><published>2012-02-08T12:35:00.000-05:00</published><updated>2012-02-08T12:36:49.532-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ISNULL()'/><category scheme='http://www.blogger.com/atom/ns#' term='NULLIF'/><category scheme='http://www.blogger.com/atom/ns#' term='ssrs'/><category scheme='http://www.blogger.com/atom/ns#' term='COALESCE()'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='reporting'/><title type='text'>NULLIF()</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana, sans-serif; font-size: 12pt;"&gt;NULLIF() returns NULL if the two parameters provided areequal; otherwise, the value of the first parameter is returned.&amp;nbsp; Seems alittle odd and not very useful, but it is a great way of ensuring that emptystrings are always returned as NULLS.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: Verdana, sans-serif; font-size: 12pt;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;"&gt;For example, the expression:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="background: white; line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;&lt;span style="font-family: 'Courier New'; font-size: 12pt;"&gt;&lt;span style="color: blue;"&gt;nullif&lt;/span&gt;(@variable1,&lt;span style="color: red;"&gt;''&lt;/span&gt;)&lt;/span&gt;&lt;span style="font-family: Verdana, sans-serif; font-size: 12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in;"&gt;&lt;span style="font-family: Verdana, sans-serif; font-size: 12pt;"&gt;&lt;br /&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;"&gt;will never return an empty string, it will returneither a NULL value or a string with at least one character present.&amp;nbsp;Also, &amp;nbsp;SQL ignores trailing spaces whencomparing strings, so even if the string isn't empty but it contains allspaces, it will still return NULL.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;"&gt;&lt;span style="background-color: transparent; line-height: 18px;"&gt;&lt;span style="font-family: 'Courier New';"&gt;&lt;span style="color: blue;"&gt;select&lt;/span&gt; &lt;span style="color: magenta;"&gt;nullif&lt;/span&gt;(&lt;span style="color: red;"&gt;' &amp;nbsp; &amp;nbsp; '&lt;/span&gt;,&lt;span style="color: red;"&gt;''&lt;/span&gt;)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Courier New'; font-size: 12pt; line-height: 13.5pt;"&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;----&lt;br /&gt;NULL&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0in;"&gt;&lt;span style="font-family: Verdana, sans-serif; font-size: 12pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana, sans-serif; font-size: 12pt;"&gt;&lt;br /&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;"&gt;NULLIF() can be a very useful function to employ.&amp;nbsp; Consider it when you need to replace default values other than justNULL when using ISNULL() or COALESCE() expressions.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana, sans-serif; font-size: 12pt;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana, sans-serif; font-size: 12pt;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa276840(v=sql.80).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa276840(v=sql.80).aspx&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-3091042813475426806?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/3091042813475426806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=3091042813475426806&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/3091042813475426806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/3091042813475426806'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2012/02/nullif.html' title='NULLIF()'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-7756890923334990109</id><published>2012-02-04T19:01:00.000-05:00</published><updated>2012-02-06T18:53:14.435-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reporting services'/><category scheme='http://www.blogger.com/atom/ns#' term='sql reporting'/><category scheme='http://www.blogger.com/atom/ns#' term='ssrs'/><category scheme='http://www.blogger.com/atom/ns#' term='empty reports'/><category scheme='http://www.blogger.com/atom/ns#' term='dat driven subscription'/><title type='text'>Avoid empty reports in a reporting services data driven subscription</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Reporting Services provides data-driven subscriptions so that you can customize the distribution of a report based on dynamic subscriber data.&amp;nbsp; Data-driven subscriptions are intended for the following kinds of scenarios:&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&amp;nbsp;Distributing reports to a large recipient pool whose membership may change from one distribution to the next. For example, distribute a monthly report to all employees.&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;Distributing reports to a specific group of recipients based on predefined criteria. For example, send a sales performance report to the top ten sales managers in an organization.&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;This is an excellent feature except that there is no clean way to stop empty emails from being sent, as in the case when your query returns an empty dataset.&amp;nbsp; &lt;/div&gt;&lt;div style="font-family: inherit;"&gt;There are many hacks that you can try&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;First, When configuring a data driven subscription, you must provide a query which returns subscriber data. Most of the time this query simply returns rows from a table which lists your data driven subscription users and their preferences around delivery and parameter values for the report in question. Each row of data returned equals one report we'll deliver as part of the subscription. Just modify this query so that it also filters the result based on whether or not the report itself will return rows. For example:&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;SELECT * from SubscriptionTable &lt;/div&gt;&lt;div style="font-family: inherit;"&gt;WHERE EXISTS(SELECT Field1 FROM DataSourceTable WHERE Field2 Between DateAdd(dd,-2,GetDate()) and GetDate())&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;If you provide this query to the wizard, it will only return subscribers for whom when there is data you wish to report on. (records in the DataSourceTable table that have a date within the last 2 days)&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In Server Management Studio under the list of jobs, you will find the subscription you created with its GUID.&amp;nbsp; The first step in the job is an EXEC command that will run the SSRS subscription. Edit this job and add a step ahead of the SSRS step.&amp;nbsp; This step does a SELECT 1/(SELECT COUNT(*) FROM MyDataSet).&amp;nbsp; If this step fails (because there is no data in the dataset the job exits reporting success, and if it succeeds, the SSRS subscription is run.&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;Use a RAISEERROR statement in your SQL script or procedure. In the case of an error the report will not be rendered.&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;IF NOT EXISTS ( SELECT * FROM MyDataTable)&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;RAISEERROR('no records found....)&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;ELSE&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: inherit;"&gt;SELECT * FROM MyDataTable&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-7756890923334990109?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/7756890923334990109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=7756890923334990109&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/7756890923334990109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/7756890923334990109'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2012/02/avoid-empty-reports-in-reporting.html' title='Avoid empty reports in a reporting services data driven subscription'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-6187622233614044583</id><published>2009-05-14T18:48:00.000-04:00</published><updated>2012-02-06T18:51:36.997-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='custom code'/><category scheme='http://www.blogger.com/atom/ns#' term='embedded'/><category scheme='http://www.blogger.com/atom/ns#' term='format data dynamically'/><category scheme='http://www.blogger.com/atom/ns#' term='ssrs'/><title type='text'>SSRS - Custom code embedded in your report</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;br /&gt;&lt;div style="background-color: white; color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif; font-size: 12px; line-height: 18px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;In Reporting Services you will often need &amp;nbsp;to manipulate or dynamically format the &amp;nbsp;report data&amp;nbsp;.&amp;nbsp; The built in &amp;nbsp;expressions &amp;nbsp;can do a lot of these, but most often you might want to format data or calculate values for which there are no expression readily available.&amp;nbsp;This is where the built in custom code comes.&lt;/div&gt;&lt;div style="background-color: white; color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif; font-size: 12px; line-height: 18px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;In one of my reports I had to calculate the Next month, having the current month and year as my input parameters.&lt;/div&gt;&lt;div style="background-color: white; color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif; font-size: 12px; line-height: 18px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;You write your custom code in the report properties code window. Go to the report layout Select &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Report -&amp;gt; &amp;nbsp;Report Properties &amp;nbsp;-&amp;gt; Code&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Function getNextDate(ByVal month As String, ByVal year As String) As String&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Try&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Dim dateNow As DateTime&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif; font-size: 12px; line-height: 18px;"&gt;dateNow&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&amp;nbsp;=month+ "-01-" + year&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Dim nextMonth As DateTime&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;nextMonth &amp;nbsp;=&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif; font-size: 12px; line-height: 18px;"&gt;dateNow&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;.AddMonths(1)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Return nextMonth&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Catch ex As exception&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;Return ex.message&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;End Try&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;End Function&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;Now in the textbox where you want the next month displayed call the custom code&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;="Next Month is &amp;nbsp;"+ code.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif; font-size: 12px; line-height: 18px;"&gt;getNextDate&lt;/span&gt;&amp;nbsp;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;(Parameters!Month.Value,Parameters!Year.Value)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;span style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif; font-size: 12px; line-height: 18px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="background-color: white; color: #333333; font-family: Arial, Helvetica, Georgia, sans-serif; font-size: 12px; line-height: 18px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-6187622233614044583?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/6187622233614044583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=6187622233614044583&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/6187622233614044583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/6187622233614044583'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2012/02/ssrs-custom-code-embedded-in-your.html' title='SSRS - Custom code embedded in your report'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-7507839527278784395</id><published>2009-04-07T18:17:00.000-04:00</published><updated>2012-02-08T12:36:32.141-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ssrs'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='reporting'/><category scheme='http://www.blogger.com/atom/ns#' term='ISNULL'/><title type='text'>ISNULL()</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-family: inherit;"&gt;The ISNULL &amp;nbsp;function&amp;nbsp;&lt;span style="background-color: white; color: #2a2a2a; line-height: 19px; text-align: -webkit-auto;"&gt;in SQL Server is used to substitute alternate value if the one being checked is “NULL”.&lt;/span&gt;&lt;span style="background-color: white; color: #2a2a2a; line-height: 19px; text-align: -webkit-auto;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white; color: #2a2a2a; line-height: 19px; text-align: -webkit-auto;"&gt;&lt;span style="font-family: inherit;"&gt;Take the following example.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="background-color: white; color: #2a2a2a; line-height: 19px; text-align: -webkit-auto;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="line-height: 19px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="color: blue;"&gt;DECLARE&lt;/span&gt;&lt;span style="color: #2a2a2a;"&gt; @var1 &lt;/span&gt;&lt;span style="color: blue;"&gt;VARCHAR(50)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="color: blue;"&gt;DECLARE&lt;/span&gt;&lt;span style="color: #2a2a2a;"&gt; @var2 &lt;/span&gt;&lt;span style="color: blue;"&gt;VARCHAR(5)&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="color: #2a2a2a;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="color: blue;"&gt;SET&lt;/span&gt;&lt;span style="color: #2a2a2a;"&gt; @var1 =&lt;/span&gt;&lt;span style="color: red;"&gt; 'Hello'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="color: blue;"&gt;SET &lt;/span&gt;&lt;span style="color: #2a2a2a;"&gt;@var2= &lt;/span&gt;&lt;span style="color: #666666;"&gt;NULL&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="color: #2a2a2a;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="color: blue;"&gt;SELECT&lt;/span&gt;&lt;span style="color: magenta;"&gt; ISNULL&lt;/span&gt;&lt;span style="color: #2a2a2a;"&gt;(@var2,@var1)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="color: #2a2a2a;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="color: #2a2a2a;"&gt;Your output is &lt;/span&gt;&lt;span style="color: red;"&gt;Hello&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="color: #2a2a2a;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #2a2a2a;"&gt;&lt;span style="font-family: inherit;"&gt;Now try substituting @var1 with a bigger sentence&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="color: blue;"&gt;SET&lt;/span&gt;&lt;span style="color: #2a2a2a;"&gt; @var1 =&lt;/span&gt;&lt;span style="color: red;"&gt; 'Hello World Its great to be here'&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="color: #2a2a2a;"&gt;&lt;span style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: inherit;"&gt;&lt;span style="color: #2a2a2a;"&gt;Now your output is just&lt;/span&gt;&lt;span style="color: red;"&gt; Hello&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: red; font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;This is because the ISNULL funnction type casts var2 to var1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: inherit;"&gt;Try the following, it will resolve the issue&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: white; margin-bottom: 0.6em; margin-top: 0.6em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="background-color: transparent; color: blue;"&gt;SELECT&lt;/span&gt;&lt;span style="background-color: transparent; color: magenta;"&gt;&amp;nbsp;ISNULL&lt;/span&gt;&lt;span style="color: #2a2a2a; font-family: inherit;"&gt;(&lt;/span&gt;&lt;span style="color: magenta; font-family: inherit;"&gt;CONVERT&lt;/span&gt;&lt;span style="color: #2a2a2a; font-family: inherit;"&gt;(&lt;/span&gt;&lt;span style="color: blue; font-family: inherit;"&gt;VARCHAR(50)&lt;/span&gt;&lt;span style="color: #2a2a2a; font-family: inherit;"&gt;, @var2),@var1)&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: white; margin-bottom: 0.6em; margin-top: 0.6em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;span style="color: #2a2a2a; font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="background-color: white; margin-bottom: 0.6em; margin-top: 0.6em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa933210(v=sql.80).aspx"&gt;&lt;span style="font-size: x-small;"&gt;http://msdn.microsoft.com/en-us/library/aa933210(v=sql.80).aspx&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-7507839527278784395?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/7507839527278784395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=7507839527278784395&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/7507839527278784395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/7507839527278784395'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2012/02/isnull.html' title='ISNULL()'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-387101420723533014</id><published>2008-03-14T19:11:00.000-04:00</published><updated>2012-02-05T09:30:07.084-05:00</updated><title type='text'>error: 26 - Error Locating Server/Instance Specified</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;span style="color: #0b5394;"&gt;"Anetwork-related or instance-specific error occurred while establishing aconnection to SQL Server. The server was not found or was not accessible.Verify that the instance name is correct and that SQL Server is configured toallow remote connections. "&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Programmers often get this error message when connecting to a SQL Server namedinstance.&amp;nbsp;&amp;nbsp;Every time a client connects t&lt;/span&gt;&lt;span style="font-size: small;"&gt;o the SQL Servernamed instance, an SSRP UDP packet is sent to the server machine UDP port 1434.This is done to know the configuration information of the SQL instance, e.g.,protocols enabled, TCP port, &lt;/span&gt;&lt;span style="font-size: small;"&gt;pipe nameetc.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal;"&gt;&lt;span style="font-size: small;"&gt;Without these information, theclient does not know how to connect to the server and it fails with the aboveerror message.&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal;"&gt;&lt;span style="font-size: small;"&gt;Make a checklist of the following&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal;"&gt;&lt;span style="font-size: small;"&gt;1. Check your server name is correct(typo).&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: inherit; text-align: left;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Check to see the instance name iscorrect and and running &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Check the server DNS (ping theserver).&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal;"&gt;&lt;span style="font-size: small;"&gt;2. Check to ensure&amp;nbsp; your database engine is configured to acceptremote connections.&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: inherit; text-align: left;"&gt;&lt;li&gt;&lt;span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: small; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Goto Start&amp;nbsp; -&amp;gt; All Programs -&amp;gt;&amp;nbsp; SQL Server 2005 -&amp;gt;&amp;nbsp; Configuration Tools -&amp;gt;&amp;nbsp; SQL Server&amp;nbsp; Surface&amp;nbsp;&amp;nbsp;Area Configuration&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: small; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Clickon Surface Area Configuration for Services and Connections&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: small; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Selectthe named instance&amp;nbsp;&amp;nbsp; -&amp;gt; DatabaseEngine&amp;nbsp; -&amp;gt;&amp;nbsp; Remote Connections&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: small; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Click&amp;nbsp; Enable local and remote connections&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: small; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Restartthe server &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal; margin-bottom: 0in; text-align: justify; vertical-align: middle;"&gt;&lt;span style="font-size: small;"&gt;3.Check the Connection string. If you are using a named SQLServer instance, make sure you are using that instance name in your connectionstrings &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;(machineName\Named Instance) &lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal; margin: 0in 0in 0in 27pt; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal; margin-bottom: 0in; text-align: justify; vertical-align: middle;"&gt;&lt;span style="font-size: small;"&gt;4.If firewall is enabled on the server make anexception&amp;nbsp; for the SQL Server instanceand port&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: inherit; text-align: left;"&gt;&lt;li&gt;&lt;span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: small; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Goto&amp;nbsp;&amp;nbsp; Start&amp;nbsp; -&amp;gt; Run -&amp;gt; Firewall.cpl&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: small; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Clickon exceptions tab&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="-moz-font-feature-settings: normal; -moz-font-language-override: normal; font-size-adjust: none; font-size: small; font-stretch: normal; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Addthe sqlservr.exe&amp;nbsp; and the default&amp;nbsp; port (1433) &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="MsoNormal" style="font-family: inherit; line-height: normal; margin-bottom: 0in; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;5.Check the SQL Browser service is running on the server, if firewall is on makean exception for the SQL Browser.exe&amp;nbsp;&amp;nbsp;and/or UDP port 1434 .&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 10pt;"&gt;For more information on &lt;/span&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;"&gt;&lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/2102.how-to-troubleshoot-connecting-to-the-sql-server-database-engine.aspx" target="_blank"&gt;&lt;span style="color: blue; font-size: 10pt;"&gt;A detailed post ofHow to Troubleshoot Connecting to the SQL Server Database Engine&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-387101420723533014?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/387101420723533014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=387101420723533014&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/387101420723533014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/387101420723533014'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2012/02/error-26-error-locating-serverinstance.html' title='error: 26 - Error Locating Server/Instance Specified'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-7667610933152763717</id><published>2008-02-09T07:56:00.000-05:00</published><updated>2008-02-09T08:21:55.125-05:00</updated><title type='text'>Dropping all tables in the current database</title><content type='html'>WHILE EXISTS(SELECT [name] FROM sys.tables WHERE [type] = 'U')&lt;br /&gt;BEGIN&lt;br /&gt;DECLARE @table_name varchar(50)&lt;br /&gt;DECLARE table_cursor CURSOR FOR SELECT [name] FROM sys.tables WHERE [type] = 'U'&lt;br /&gt;OPEN table_cursor&lt;br /&gt;FETCH NEXT FROM table_cursor INTO @table_name&lt;br /&gt;WHILE @@FETCH_STATUS = 0&lt;br /&gt;BEGIN&lt;br /&gt;BEGIN TRY&lt;br /&gt;EXEC ('DROP TABLE [' + @table_name + ']')&lt;br /&gt;PRINT 'Dropped Table ' + @table_name&lt;br /&gt;END TRY&lt;br /&gt;BEGIN CATCH&lt;br /&gt;END CATCH&lt;br /&gt;FETCH NEXT FROM table_cursor INTO @table_name&lt;br /&gt;END&lt;br /&gt;CLOSE table_cursor&lt;br /&gt;DEALLOCATE table_cursor&lt;br /&gt;END&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-7667610933152763717?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/7667610933152763717/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=7667610933152763717&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/7667610933152763717'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/7667610933152763717'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2008/02/dropping-all-tables-in-current-database.html' title='Dropping all tables in the current database'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-2650602846947893237</id><published>2007-10-18T03:41:00.000-04:00</published><updated>2007-10-18T04:15:31.207-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='database fields in report header footer rdlc reportviewer localreport'/><title type='text'>Database fields in Report header / footer</title><content type='html'>A database field can neither be placed in a report header nor in the footer. This will throw an error &lt;em&gt;"The Value expression for the textbox &amp;lt;fieldname&amp;gt; refers to a field.  Fields cannot be used in page headers or footers".&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;There is however a workaround. Place a hidden textbox in the report body call it tb_hidden and assign to this the database field that you need in the header. Place a textbox in the report header and assign the hidden textbox's value to it&lt;br /&gt;ex:        &lt;strong&gt;=reportitems!tb_hidden.Value&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This however as a drawback, the value will appear only in the first page. If your report runs into many pages then you need to take a different approach.&lt;br /&gt;&lt;br /&gt;Pass the value to appear in the header as a parameter from your .aspx page call it &lt;em&gt;database_field&lt;/em&gt;.  Assign this to the textbox in the header.&lt;br /&gt;ex:        &lt;strong&gt;=Parameters!database_field.Value&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-2650602846947893237?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/2650602846947893237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=2650602846947893237&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/2650602846947893237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/2650602846947893237'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2007/10/database-fields-in-report-header-footer.html' title='Database fields in Report header / footer'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-7835308719240281309</id><published>2007-10-12T05:33:00.001-04:00</published><updated>2012-02-08T12:41:02.942-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='format date time year telephone String'/><title type='text'>Formatting Text in Reports</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I often find requests for help in formatting strings. Just remember you can use your r vb formatting syntax here be it just text, date or numbers.The following are some samples in formatting Strings&lt;strong&gt;Formatting a telephone no&lt;/strong&gt;:&lt;br /&gt;&lt;div style="background: #eee; margin-left: 25px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px; width: 80%;"&gt;&lt;span style="font-family: arial;"&gt;If the database field is numeric then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;&amp;nbsp;=Format(12345678,"(###)##-###")&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;&amp;nbsp;or&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;=Format(Fields!phonenumber.value,"(###)##-###")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;&amp;nbsp;If the field is of datatype String then you need to convert it &amp;nbsp; =Format(Cdbl("12345678"),"(###)##-###"))&lt;/span&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;Formatting Date and Time&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Examples of applying a format string to date/time values are shown in the following table.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;Format &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Output&lt;br /&gt;&amp;nbsp;Format(Now,"D") &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Friday, October 12, 2007&lt;br /&gt;&amp;nbsp;Format(Now,"d") &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10/12/2007&lt;br /&gt;&amp;nbsp;Format(Now,"T") &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6:37:23 AM &amp;nbsp;&lt;br /&gt;&amp;nbsp;Format(Now,"t") &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;6:37 AM&lt;br /&gt;&amp;nbsp;Format(Now,"F") &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Friday, October 12, 2007 6:37:23 AM&lt;br /&gt;&amp;nbsp;Format(Now,"f") &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Friday, October 12, 2007 6:37 AM&lt;br /&gt;&amp;nbsp;Format(Now,"g") &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10/12/2007 6:37 AM&lt;br /&gt;&amp;nbsp;Format(Now,"m") &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;October 12&lt;br /&gt;&amp;nbsp;Format(Now,"y") &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; October, 2007&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-7835308719240281309?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/7835308719240281309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=7835308719240281309&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/7835308719240281309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/7835308719240281309'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2007/10/formatting-text-in-reports.html' title='Formatting Text in Reports'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-4981617015808294208</id><published>2007-09-25T08:23:00.000-04:00</published><updated>2007-10-12T06:26:50.586-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='customize reportviewer messages render excel hide toolbar localreport'/><title type='text'>Customize the reportviewer toolbar</title><content type='html'>&lt;strong&gt;Customize the ReportViewer ToolBar&lt;/strong&gt;&lt;br /&gt;You can customize the existing toolbar, however it is not possible to extend it.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;You can hide the default reportviewer toolbar using the code &lt;/p&gt;&lt;em&gt;ReportViewer1.ShowToolBar = false&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;&lt;strong&gt;Customize your Toolbar&lt;/strong&gt;&lt;br /&gt;You can write your own &lt;strong&gt;Find&lt;/strong&gt; Button as:&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: #eee; PADDING-BOTTOM: 10px; MARGIN-LEFT: 25px; WIDTH: 80%; PADDING-TOP: 10px"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Dim found As Integer = Me.ReportViewer1.Find(txtFind.Text, 1)&lt;br /&gt;If found &gt; 0 Then&lt;br /&gt;btnFindNext.Enabled = True&lt;br /&gt;Else&lt;br /&gt;MessageBox.Show("String not found", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)&lt;br /&gt;btnFindNext.Enabled = False&lt;br /&gt;End If&lt;br /&gt;Return True&lt;br /&gt;&lt;/div&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Your own &lt;strong&gt;export to pdf&lt;/strong&gt; button:&lt;br /&gt;refer my earlier article "render rdlc as pdf"&lt;br /&gt;&lt;br /&gt;Your own &lt;strong&gt;export to excel &lt;/strong&gt;button:&lt;br /&gt;Follow the steps as mentioned in my earlier article "render rdlc as pdf"&lt;br /&gt;and replace the code in Samples.aspx with the one given below :&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: #eee; PADDING-BOTTOM: 10px; MARGIN-LEFT: 25px; WIDTH: 80%; PADDING-TOP: 10px"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Protected Sub Page_SaveStateComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SaveStateComplete&lt;br /&gt;Dim warnings As Warning() = Nothing&lt;br /&gt;Dim streamids As String() = Nothing&lt;br /&gt;Dim mimeType As String = Nothing&lt;br /&gt;Dim encoding As String = Nothing&lt;br /&gt;Dim extension As String = Nothing&lt;br /&gt;Dim bytes As Byte()&lt;br /&gt;&lt;br /&gt;Dim FolderLocation As String = "D:\SampleProjects\"&lt;br /&gt;'First delete existing file&lt;br /&gt;Dim filepath As String = FolderLocation &amp; "Employee.xls"&lt;br /&gt;File.Delete(filepath)&lt;br /&gt;'Then create new excel file&lt;br /&gt;bytes = ReportViewer1.LocalReport.Render("Excel", Nothing, mimeType, encoding, extension, streamids, warnings)&lt;br /&gt;Dim fs As New FileStream(FolderLocation &amp; "Employee.xls", FileMode.Create)&lt;br /&gt;fs.Write(bytes, 0, bytes.Length)&lt;br /&gt;fs.Close()&lt;br /&gt;'Set the appropriate ContentType.&lt;br /&gt;Response.ContentType = "application/vnd.ms-excel"&lt;br /&gt;'Write the file directly to the HTTP output stream.&lt;br /&gt;Response.WriteFile(filepath)&lt;br /&gt;Response.End()&lt;br /&gt;End Sub&lt;br /&gt;End Class&lt;br /&gt;&lt;/div&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;To customize the reportviewer Messages&lt;/strong&gt;&lt;br /&gt;You can implement the IReportViewerMessages interface to provide custom localization of the ReportViewer control user interface. This implementation can be passed to the ReportViewer control by adding a custom application setting to the the web.config file using the key “ReportViewerMessages”.&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;p&gt;&lt;div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: #eee; PADDING-BOTTOM: 10px; MARGIN-LEFT: 25px; WIDTH: 80%; PADDING-TOP: 10px"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&amp;lt;appsettings&amp;gt;&lt;br /&gt;&amp;lt;add value="MyClass, MyAssembly" key="ReportViewerMessages"&amp;gt;&lt;br /&gt;&amp;lt;/appsettings&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The following code is an example of a class that implements the IReportViewerMessages interface.&lt;br /&gt;&lt;p&gt;&lt;div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: #eee; PADDING-BOTTOM: 10px; MARGIN-LEFT: 25px; WIDTH: 80%; PADDING-TOP: 10px"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Imports System&lt;br /&gt;Imports System.Collections.Generic&lt;br /&gt;Imports System.Text&lt;br /&gt;Imports Microsoft.Reporting.WebForms&lt;br /&gt;&lt;br /&gt;Namespace MySample&lt;br /&gt;Public Class MyReportViewerCustomMessages&lt;br /&gt;Implements Microsoft.Reporting.WebForms.IReportViewerMessages&lt;br /&gt;#Region "IReportViewerMessages Members"&lt;br /&gt;&lt;br /&gt;Public ReadOnly Property BackButtonToolTip() As String&lt;br /&gt;Get&lt;br /&gt;Return ("Add your custom text here.")&lt;br /&gt;End Get&lt;br /&gt;End Property&lt;br /&gt;&lt;br /&gt;Public ReadOnly Property ChangeCredentialsText() As String&lt;br /&gt;Get&lt;br /&gt;Return ("Add your custom text here.")&lt;br /&gt;End Get&lt;br /&gt;End Property&lt;br /&gt;&lt;br /&gt;Public ReadOnly Property ChangeCredentialsToolTip() As String&lt;br /&gt;Get&lt;br /&gt;Return ("Add your custom text here.")&lt;br /&gt;End Get&lt;br /&gt;End Property&lt;br /&gt;&lt;br /&gt;Public ReadOnly Property CurrentPageTextBoxToolTip() As String&lt;br /&gt;Get&lt;br /&gt;Return ("Add your custom text here.")&lt;br /&gt;End Get&lt;br /&gt;End Property&lt;br /&gt;#End Region&lt;br /&gt;End Class&lt;br /&gt;End Namespace &lt;/div&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Note: All messages are not implemented here. If you do not specify custom messages then the default is taken.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-4981617015808294208?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/4981617015808294208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=4981617015808294208&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/4981617015808294208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/4981617015808294208'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2007/09/customize-reportviewer-toolbar-you-can.html' title='Customize the reportviewer toolbar'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-4437322267260991604</id><published>2007-09-20T02:55:00.000-04:00</published><updated>2007-10-12T06:25:08.075-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='images external database embeded localreport reportviewer'/><title type='text'>Adding Images to your report</title><content type='html'>&lt;strong&gt;Adding Images to your Report&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;There are 3 ways in which you can add images to your report&lt;br /&gt;1. Embeded&lt;br /&gt;2. External&lt;br /&gt;3. Database&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Embeding Images&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Open your report. Drag and drop an image icon.&lt;br /&gt;Click on the image and press F4, the properties window pops up&lt;br /&gt;Under the group &lt;strong&gt;data&lt;/strong&gt; you'll find &lt;strong&gt;source&lt;/strong&gt; choose &lt;strong&gt;embeded&lt;/strong&gt;.&lt;br /&gt;To embed images to your report choose &lt;strong&gt;report property &lt;/strong&gt;on the menu (Click on the report if you can't see this),&lt;br /&gt;Click on &lt;strong&gt;Report Images&lt;/strong&gt; and choose the images you want to embed.&lt;br /&gt;Now, In the value property of your image choose the image you want to display.&lt;br /&gt;&lt;br /&gt;Embedded images are ok for small logo files, but for huge bmp files &lt;strong&gt;external images &lt;/strong&gt;work better.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;External Images&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Set the &lt;strong&gt;source&lt;/strong&gt; as &lt;strong&gt;external&lt;/strong&gt; and set the value for external files as the &lt;strong&gt;virtual path&lt;/strong&gt; to the image folder. ex: http://servername/imagefoldername/imagename&lt;br /&gt;&lt;br /&gt;Also enable external images in your aspx page&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;em&gt;ReportViewer1.LocalReport.EnableExternalImages = True&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Database Images&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Set the &lt;strong&gt;source&lt;/strong&gt; as &lt;strong&gt;Database&lt;/strong&gt; and set the value for external files as the &lt;strong&gt;fieldname&lt;/strong&gt;&lt;br /&gt;In the textbox write the foll expression.&lt;br /&gt;=Convert.ToBase64String(Fields!Image.Value)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Placing a database image in your header&lt;/strong&gt;&lt;br /&gt;Since database fields are not accessible from the header, place a hidden textbox in your report call it tb_images and set the value, as mentioned above for database images. Now place an image icon in the header and set its value to the hidden image textbox  i.e&lt;br /&gt;     =ReportItems!tb_Image.Value&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Dynamically Change Image&lt;/strong&gt;&lt;br /&gt;In certain case you  may have to dynamicaaly place a header image based on the department.&lt;br /&gt;The code can be placed in a code window.  Select Report -&gt; Report Properties -&gt; Code (tab) in the VS.NET designer.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: #eee; PADDING-BOTTOM: 10px; MARGIN-LEFT: 25px; WIDTH: 80%; PADDING-TOP: 10px"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Function ShowHeaderImage(value as Object) As String   &lt;br /&gt;&lt;br /&gt;    Dim strURL as String = "http://&lt;server&gt;/images/"&lt;br /&gt;    Dim strImg as String     &lt;br /&gt;    Select Case value        &lt;br /&gt;    Case Nothing  &lt;br /&gt;            strImg = "heading1.jpg"           &lt;br /&gt;    Case 1       &lt;br /&gt;            strImg = "heading2.jpg"  &lt;br /&gt;    Case 2  &lt;br /&gt;            strImg = "heading3.jpg"     &lt;br /&gt;    End Select   &lt;br /&gt;   Return strImg&lt;br /&gt;End Function&lt;br /&gt;&lt;/div&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Place an image icon in the report body and set its source as &lt;strong&gt;external.&lt;/strong&gt; In the &lt;strong&gt;value&lt;/strong&gt; property&lt;br /&gt;enter the following&lt;br /&gt;=Code.ShowHeaderImage(Fields!&lt;imagefield&gt;.Value)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-4437322267260991604?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/4437322267260991604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=4437322267260991604&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/4437322267260991604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/4437322267260991604'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2007/09/adding-images-to-your-report-there-are.html' title='Adding Images to your report'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4534665907494175367.post-2601848834687140217</id><published>2007-08-31T01:01:00.000-04:00</published><updated>2008-11-13T16:57:20.650-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reportviewer rdlc pdf .net localreport'/><title type='text'>render rdlc as pdf</title><content type='html'>&lt;span style="font-family:arial;"&gt;This article shows how to generate reports using the ASP.NET 2.0 Reportviewer server control using LocalReports with parameterized table adapters. I am using ASP.NET 2.0, Visual Studio 2005, and SQL Server 2005&lt;br /&gt;&lt;br /&gt;The difference between Local Reports and Server Reports is that in Server Reports the client makes a report request to the server. The server generates the report and then sends it to the client. While this is more secure, it lowers performance due to transfer time from server to client.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;In LocalReports, reports are generated at the client end and does not connect to the "SQL Server Reporting Services Server" .&lt;br /&gt;Using the AdventureWorks database, this example will get the parameters for the table adapters as a queryString from the requesting aspx page.&lt;br /&gt;&lt;br /&gt;You can download AdventureWorks database from&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=487c9c23-2356-436e-94a8-2bfb66f0abdc&amp;amp;displayLang=en"&gt;&lt;span style="font-family:arial;"&gt;http://www.microsoft.com/downloads/thankyou.aspx?familyId=487c9c23-2356-436e-94a8-2bfb66f0abdc&amp;amp;displayLang=en&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt;1. Open a new Website call it SampleReport.&lt;br /&gt;&lt;br /&gt;2. Right click on solution in the Solution explorer. Go to &lt;strong&gt;Add new item&lt;/strong&gt; and choose &lt;strong&gt;DataSet&lt;/strong&gt;. Call it dsReport.xsd.&lt;br /&gt;&lt;br /&gt;3. Open the dataset . Right click and choose Add -&gt; &lt;strong&gt;TableAdapter&lt;/strong&gt;. Open AdventureWorks DataBase and choose table Employee. Select all fields and append the "where" clause. (ex where employeeid = @employeeid)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;p align="center"&gt;&lt;a href="http://1.bp.blogspot.com/_VhFAYeRIthk/Rte5fYFKcZI/AAAAAAAAAAM/Gm7xT46pEww/s1600-h/selecttable.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104752651338936722" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_VhFAYeRIthk/Rte5fYFKcZI/AAAAAAAAAAM/Gm7xT46pEww/s320/selecttable.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_VhFAYeRIthk/Rte5z4FKcaI/AAAAAAAAAAU/xMqI5OzsSu0/s1600-h/setparam.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104753003526255010" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_VhFAYeRIthk/Rte5z4FKcaI/AAAAAAAAAAU/xMqI5OzsSu0/s320/setparam.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://4.bp.blogspot.com/_VhFAYeRIthk/Rte66IFKcbI/AAAAAAAAAAc/f-hNOclIvcs/s1600-h/tbladapter.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104754210412065202" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_VhFAYeRIthk/Rte66IFKcbI/AAAAAAAAAAc/f-hNOclIvcs/s320/tbladapter.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;4. Right click on solution in the Solution explorer. Go to &lt;strong&gt;Add new item&lt;/strong&gt; and choose &lt;strong&gt;Report&lt;/strong&gt;. Call it Report.rdlc &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;5. Design the report to display the EmployeeDetails. Choose &lt;strong&gt;Data -&gt; show data sources&lt;/strong&gt; from the Report Menu. Drag and drop the fields to be displayed on your designer.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_VhFAYeRIthk/Rte9YIFKccI/AAAAAAAAAAk/fXWAcE1HPyM/s1600-h/report1.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104756924831396290" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_VhFAYeRIthk/Rte9YIFKccI/AAAAAAAAAAk/fXWAcE1HPyM/s320/report1.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;6. Add new aspx page call it SampleReport.aspx. Drag and drop a ReportViewer from the toolbar . Now bind the rdlc to the reportviewer by bringing up the smart tag of the ReportViewer control and selecting "Report.rdlc" in the "Choose Report" dropdown list. &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_VhFAYeRIthk/Rte-DIFKcdI/AAAAAAAAAAs/zn8_tREIWns/s1600-h/selectreport.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104757663565771218" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_VhFAYeRIthk/Rte-DIFKcdI/AAAAAAAAAAs/zn8_tREIWns/s320/selectreport.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;7. Now Select  "&lt;strong&gt;Choose Data Sources&lt;/strong&gt;" and choose an ObjectDataSource.&lt;br /&gt;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_VhFAYeRIthk/Rte-jYFKceI/AAAAAAAAAA0/eq3LDT_ZdU4/s1600-h/datasorce.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104758217616552418" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_VhFAYeRIthk/Rte-jYFKceI/AAAAAAAAAA0/eq3LDT_ZdU4/s320/datasorce.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt;8. Configure the ODS to take the input parameter as a querystring. (Need to pass the parameter as a queryString in order to render as pdf) &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_VhFAYeRIthk/RtfAUoFKcgI/AAAAAAAAABE/aaWCpUZSOyY/s1600-h/configuredatasorce.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104760163236737538" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_VhFAYeRIthk/RtfAUoFKcgI/AAAAAAAAABE/aaWCpUZSOyY/s320/configuredatasorce.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://2.bp.blogspot.com/_VhFAYeRIthk/RtfAUoFKchI/AAAAAAAAABM/u8H3YjHICa4/s1600-h/configuredatasorce1.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104760163236737554" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_VhFAYeRIthk/RtfAUoFKchI/AAAAAAAAABM/u8H3YjHICa4/s320/configuredatasorce1.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://3.bp.blogspot.com/_VhFAYeRIthk/RtfAU4FKciI/AAAAAAAAABU/sNqJshTmu2U/s1600-h/configuredatasorce2.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104760167531704866" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_VhFAYeRIthk/RtfAU4FKciI/AAAAAAAAABU/sNqJshTmu2U/s320/configuredatasorce2.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://4.bp.blogspot.com/_VhFAYeRIthk/RtfAVIFKcjI/AAAAAAAAABc/quGOlsnerhg/s1600-h/configuredatasorce3.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104760171826672178" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://4.bp.blogspot.com/_VhFAYeRIthk/RtfAVIFKcjI/AAAAAAAAABc/quGOlsnerhg/s320/configuredatasorce3.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;a href="http://4.bp.blogspot.com/_VhFAYeRIthk/RtfAVIFKckI/AAAAAAAAABk/rlCtKu89V4Q/s1600-h/configuredatasorce4.JPG"&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;9. Give the queryString name the same as you would use in your default.aspx page. &lt;/span&gt;&lt;/p&gt;&lt;a href="http://1.bp.blogspot.com/_VhFAYeRIthk/RtfBgYFKclI/AAAAAAAAABs/fSVv_Xfc-i8/s1600-h/configuredatasorce4.JPG"&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5104761464611828306" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_VhFAYeRIthk/RtfBgYFKclI/AAAAAAAAABs/fSVv_Xfc-i8/s320/configuredatasorce4.JPG" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;10. Open your default.aspx page and call the SampleReport.aspx. Add the following codeSnippet.. Note this is only an example. The default.aspx page can have a data grid listing all emplyee details. The user can click on an id and pass multiple queryString values to your SampleReport.aspx which in turn can have multiple datasets and/or table adapters. &lt;/span&gt;&lt;/p&gt;&lt;div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: #eee; PADDING-BOTTOM: 10px; MARGIN-LEFT: 25px; WIDTH: 80%; PADDING-TOP: 10px"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Imports System.IO&lt;br /&gt;Imports Microsoft.Reporting.WebForms&lt;br /&gt;Partial Class _Default&lt;br /&gt;Inherits System.Web.UI.Page&lt;br /&gt;Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load&lt;br /&gt;Response.Redirect("SampleReport.aspx?employeeid=1")&lt;br /&gt;End Sub&lt;br /&gt;End Class&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;11. Add the foll code in your SampleReport.aspx.&lt;/span&gt;&lt;/p&gt;&lt;div style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: #eee; PADDING-BOTTOM: 10px; MARGIN-LEFT: 25px; WIDTH: 80%; PADDING-TOP: 10px"&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Imports System.IO&lt;br /&gt;Imports System.data&lt;br /&gt;Imports Microsoft.Reporting.WebForms&lt;br /&gt;Partial Class SampleReport&lt;br /&gt;Inherits System.Web.UI.Page&lt;br /&gt;Protected Sub Page_SaveStateComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SaveStateComplete&lt;br /&gt;Dim warnings As Warning() = Nothing&lt;br /&gt;Dim streamids As String() = Nothing&lt;br /&gt;Dim mimeType As String = Nothing&lt;br /&gt;Dim encoding As String = Nothing&lt;br /&gt;Dim extension As String = Nothing&lt;br /&gt;Dim bytes As Byte()&lt;br /&gt;&lt;br /&gt;Dim FolderLocation As String = "D:\SampleProjects\"&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;'First delete existing file&lt;br /&gt;&lt;/span&gt;Dim filepath As String = FolderLocation &amp;amp; "Employee.PDF"&lt;br /&gt;File.Delete(filepath)&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;'Then create new pdf file&lt;br /&gt;&lt;/span&gt;bytes = ReportViewer1.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings)&lt;br /&gt;Dim fs As New FileStream(FolderLocation &amp;amp; "Employee.PDF", FileMode.Create)&lt;br /&gt;fs.Write(bytes, 0, bytes.Length)&lt;br /&gt;fs.Close()&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;'Set the appropriate ContentType.&lt;/span&gt;&lt;br /&gt;Response.ContentType = "Application/pdf"&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;'Write the file directly to the HTTP output stream.&lt;/span&gt;&lt;br /&gt;Response.WriteFile(filepath)&lt;br /&gt;Response.End()&lt;br /&gt;End Sub&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;12. Build and Run your WebSite.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4534665907494175367-2601848834687140217?l=technoblab.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://technoblab.blogspot.com/feeds/2601848834687140217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4534665907494175367&amp;postID=2601848834687140217&amp;isPopup=true' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/2601848834687140217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4534665907494175367/posts/default/2601848834687140217'/><link rel='alternate' type='text/html' href='http://technoblab.blogspot.com/2007/08/render-rdlc-as-pdf.html' title='render rdlc as pdf'/><author><name>Madhubala</name><uri>http://www.blogger.com/profile/04514234918092263820</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_VhFAYeRIthk/Rte5fYFKcZI/AAAAAAAAAAM/Gm7xT46pEww/s72-c/selecttable.JPG' height='72' width='72'/><thr:total>9</thr:total></entry></feed>
