tag:blogger.com,1999:blog-34694605275260085702024-03-14T07:37:11.345-07:00Developers ManiaSheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.comBlogger28125tag:blogger.com,1999:blog-3469460527526008570.post-77899056533735894662022-09-24T23:48:00.001-07:002022-09-25T01:19:51.320-07:00Truncate a SQL Server log file (Reduce the size of an LDF file)<div>
<p>
I have been doing database administration and have been asked several times to reduce the size of database files. The actual mdf file is small, 3MB, but the LDF file is 10GB !!
<br/>
I have read about the DBCC SHRINKFILE command and tried this, but the file has stayed at 10GB even though it said the command executed fine.
<br/>
I've also tried using the wizard in SQL Server to reduce the LDF to a specified file size (800MB), this also failed to change the size even though it gave me the impression it had worked and was successful via the wizard.
</p>
<p>
The best thing I found is to change the recovery mode of database to <b>RECOVERY SIMPLE</b> before executing the <b>SHRINKFILE</b> command. After that change back the recovery mode to <b>FULL</b>.
</p>
</div>
<br />
<pre class="brush: sql" >
ALTER DATABASE ExampleDB SET RECOVERY SIMPLE
DBCC SHRINKFILE('ExampleDB_log', 0, TRUNCATEONLY)
ALTER DATABASE ExampleDB SET RECOVERY FULL
</pre><br />
<p>
Happy Coding :)
</p>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-1959908653654091432021-05-18T13:58:00.003-07:002021-05-18T14:04:16.624-07:00Configuring CORS in IIS - Response to preflight request doesn't pass access control check: It does not have HTTP ok statusThe Access-Control-Allow-Origin Header Explained – With a CORS Example
Often times when calling an API, you may see an error in your console that looks like this:
<pre class="brush: jscript">
Access to fetch at 'http://somesite.com' from origin 'http://yoursite.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value that is not equal to the supplied origin
</pre>
<br />
<br />
Add following in
<pre class="brush: jscript">
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Methods" value="*" />
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="*" />
</customHeaders>
</system.webServer>
</pre>
After adding the above code in web.config, received the following error in response.
<pre class="brush: jscript">
.... Has been blocked by CORS policy: Response to preflight request
doesn’t pass access control check: it does not have http ok status
</pre>
<br />
You may still need to remove the default IIS OPTIONSVerbHandler, then add the
OPTIONS verb to appropriate handler(s) to allow the requests to get to your
api.
then removing/commenting the following "OPTIONSVerbHandler" handler line
//This line was not documented on Microsoft website >
<pre class="brush: csharp">
<!--<remove name="OPTIONSVerbHandler" />-->
</pre>
or changing it with the following:
<pre class="brush: csharp">
<add name="OPTIONSVerbHandler" path="*" verb="OPTIONS"
modules="ProtocolSupportModule" requireAccess="None"
responseBufferLimit="4194304" />
</pre>
<br />
// For me it worked without adding the following code in Web API. but for the
safe side ...
Then in the Global.asax file, add the following method:
<br />
<pre class="brush: csharp">
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (HttpContext.Current.Request.HttpMethod == "OPTIONS")
{
HttpContext.Current.Response.Flush();
}
}
</pre>
Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-12382382896773694412017-12-19T00:31:00.001-08:002017-12-19T00:31:25.046-08:00ASP.NET Page Life Cycle - with MasterPage, UserControl & BaseClass<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoDBvY8VIwHs5qIAK79ct6vvqJA0V0MJtRc4Cx8fhpJESB6dblRloCZMzVdATW_2jKQb0oIbYxfyPq4jBnDbn1WqNqcf4B0buHYX9GAYpRwM4yUSvrvo1k8-XGHHdGz7x0NolvPdWh0mMD/s1600/01.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="662" data-original-width="960" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoDBvY8VIwHs5qIAK79ct6vvqJA0V0MJtRc4Cx8fhpJESB6dblRloCZMzVdATW_2jKQb0oIbYxfyPq4jBnDbn1WqNqcf4B0buHYX9GAYpRwM4yUSvrvo1k8-XGHHdGz7x0NolvPdWh0mMD/s1600/01.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTk9FbESifwxSG6ZEqDyz4HtoQ_MtjLbRvirjtp-TTufvo4uweudp_QxWLXXoeMFDhmNKFSaUGNTdNJHXpeNipudk8rD1wAjtEzFJeHQkN7UYUBFmylRjYDLLn9O9fvlGW058iaxJ6AQlq/s1600/02.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="660" data-original-width="955" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTk9FbESifwxSG6ZEqDyz4HtoQ_MtjLbRvirjtp-TTufvo4uweudp_QxWLXXoeMFDhmNKFSaUGNTdNJHXpeNipudk8rD1wAjtEzFJeHQkN7UYUBFmylRjYDLLn9O9fvlGW058iaxJ6AQlq/s1600/02.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSyNPDGxuNrbhHDrey_bLHUVpRFLeEaoVYYba4iUT9pf-qgTmiILEfJLUDTMasqgtj0M99QhO1NXcrGU-EjjA7M2ie21p6knfL1xKiVckm0BqawsbqHS27zcQpTz-DuVjVaneQc2Z7vWin/s1600/03.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="510" data-original-width="1190" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSyNPDGxuNrbhHDrey_bLHUVpRFLeEaoVYYba4iUT9pf-qgTmiILEfJLUDTMasqgtj0M99QhO1NXcrGU-EjjA7M2ie21p6knfL1xKiVckm0BqawsbqHS27zcQpTz-DuVjVaneQc2Z7vWin/s1600/03.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAEmZUqXDluxA9PQfP0mUCMOZcxRLnLh5IYrX7tBUXY8ntquN6GrCq2J7zzAlrgwyoT-eIvTQs_GS8x65E8KKest2jE8vcE3zo-ir7xtNINX2WpBsNL8de3IWZfeUdDFJv7p-Pv-BhtrRb/s1600/06.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="660" data-original-width="955" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAEmZUqXDluxA9PQfP0mUCMOZcxRLnLh5IYrX7tBUXY8ntquN6GrCq2J7zzAlrgwyoT-eIvTQs_GS8x65E8KKest2jE8vcE3zo-ir7xtNINX2WpBsNL8de3IWZfeUdDFJv7p-Pv-BhtrRb/s1600/06.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU2O0J9v3ZAuledMej9JLfsZOE_eFhrThrvdqrSXkpXt4cKRRvblEPDQQ8OCztUmzOceNzayjVYsRI1sIYm20yyBq-8MsTtQNjvS9Zfq8rX1TMfnx0SWPk5jcUWimnirj5i7lPd2BD-fpj/s1600/07.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="500" data-original-width="1188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhU2O0J9v3ZAuledMej9JLfsZOE_eFhrThrvdqrSXkpXt4cKRRvblEPDQQ8OCztUmzOceNzayjVYsRI1sIYm20yyBq-8MsTtQNjvS9Zfq8rX1TMfnx0SWPk5jcUWimnirj5i7lPd2BD-fpj/s1600/07.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnOwJvLinmatCHrBypNmh1CMubbAqIWu67vl6W_ypjJYHko9o2oWJ0qqkoExZEC4Kynq7Cdc3ecrJn3xw0vNpxAKM8esrmzSh9ONoYr6A8gWADtvf9vMVDil0eDNTF1LLKHS4vOKPbWqZ8/s1600/08.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="660" data-original-width="996" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnOwJvLinmatCHrBypNmh1CMubbAqIWu67vl6W_ypjJYHko9o2oWJ0qqkoExZEC4Kynq7Cdc3ecrJn3xw0vNpxAKM8esrmzSh9ONoYr6A8gWADtvf9vMVDil0eDNTF1LLKHS4vOKPbWqZ8/s1600/08.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWyfgzdBthCW2GT0LTvg3DMaI7yVrJesxLAlR6-WNCrfr8v17liazvGxzeudgB51yxjlygKMJw_m4KdT7S0OIJ_zIZsufqRRCDoauenRPZ42ywDc9oIqRjHu5ZCMWv_kbZ2KZPIxJbqed/s1600/10.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="660" data-original-width="955" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRWyfgzdBthCW2GT0LTvg3DMaI7yVrJesxLAlR6-WNCrfr8v17liazvGxzeudgB51yxjlygKMJw_m4KdT7S0OIJ_zIZsufqRRCDoauenRPZ42ywDc9oIqRjHu5ZCMWv_kbZ2KZPIxJbqed/s1600/10.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXd9gqoXLcE95D6RqE9UEIGWpDoHVsJKc1vVytlfPG8dSgZK6h9F_BFHdYoUKG0GpYfAqxY1CYdd08VH0hEfxj_qP6ULwjbdoIfEjW16-zY2Cq1bNZLxz5PYHV9k9lg7BnfQ2AgZmrwpvK/s1600/11.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="283" data-original-width="1189" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXd9gqoXLcE95D6RqE9UEIGWpDoHVsJKc1vVytlfPG8dSgZK6h9F_BFHdYoUKG0GpYfAqxY1CYdd08VH0hEfxj_qP6ULwjbdoIfEjW16-zY2Cq1bNZLxz5PYHV9k9lg7BnfQ2AgZmrwpvK/s1600/11.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7P5E7A1KkEfQ1V0Crnr3-OnrMXMey4I6-K0mY7lYY8V5PJxgXFLaA1vCM4Klbjm03AugVat3UO_J5anusEuXUlIPuxmnrBFs6pyF7mfCush09TPlzfEnLzFuqEXJe9w3MNAfrz1HOJDg7/s1600/12.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="1188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7P5E7A1KkEfQ1V0Crnr3-OnrMXMey4I6-K0mY7lYY8V5PJxgXFLaA1vCM4Klbjm03AugVat3UO_J5anusEuXUlIPuxmnrBFs6pyF7mfCush09TPlzfEnLzFuqEXJe9w3MNAfrz1HOJDg7/s1600/12.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7tUFlDDd9urtDI-ASeh3i-D93wLAqjmOkdUIfDpq-eV_CXgciv-mDcpr_5bCca6ap30sWHynrH4B6bAdxRMA4LLgYh_3gDq_UMZkDOkO4amu2rTCu-7OitRvvcI01uVa2HYkRSXOsAMqg/s1600/13.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="206" data-original-width="466" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7tUFlDDd9urtDI-ASeh3i-D93wLAqjmOkdUIfDpq-eV_CXgciv-mDcpr_5bCca6ap30sWHynrH4B6bAdxRMA4LLgYh_3gDq_UMZkDOkO4amu2rTCu-7OitRvvcI01uVa2HYkRSXOsAMqg/s1600/13.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZKNihH73x-M_AQRK24aDG8KChmK7IDtQhE73olgAbrTqGaztxvGwr0qcMnUa-HMkOlmlVDana1vEQAkO9zxdVdk4cfwnAe5RHasXWXa1nnJwUh23SrtDK2DE1PNxT2bACSk3Q2D2DUU0_/s1600/14.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="464" data-original-width="1208" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZKNihH73x-M_AQRK24aDG8KChmK7IDtQhE73olgAbrTqGaztxvGwr0qcMnUa-HMkOlmlVDana1vEQAkO9zxdVdk4cfwnAe5RHasXWXa1nnJwUh23SrtDK2DE1PNxT2bACSk3Q2D2DUU0_/s1600/14.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhniUGcSWN5PALx_e5Tq41V9DL9BQoRqZNDfQxQcwE6ViSBm86pVZS8ZnwFbWm8oR3iZXEfjUC-lxKFVU2MH-snIHqbZJBEwNwfCV__StnRP8Fl03u5MetxV6gGTAHDmZBBSyRvblHNvb4/s1600/15.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="208" data-original-width="469" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhniUGcSWN5PALx_e5Tq41V9DL9BQoRqZNDfQxQcwE6ViSBm86pVZS8ZnwFbWm8oR3iZXEfjUC-lxKFVU2MH-snIHqbZJBEwNwfCV__StnRP8Fl03u5MetxV6gGTAHDmZBBSyRvblHNvb4/s1600/15.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVCDpx907frJovGZzbzATPPg-U1JuGjH8KPW-AenI3cZ20-17Buu1O-30kLvmZg1KRYBvWW9SAHBdd9qS12nFyIgeXo0W9fxclYonrT4dsOe52hnbpIpk0JdhARCYQ98zDmbN4N0omATYt/s1600/16.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="459" data-original-width="1191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVCDpx907frJovGZzbzATPPg-U1JuGjH8KPW-AenI3cZ20-17Buu1O-30kLvmZg1KRYBvWW9SAHBdd9qS12nFyIgeXo0W9fxclYonrT4dsOe52hnbpIpk0JdhARCYQ98zDmbN4N0omATYt/s1600/16.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWK-fQt3MpCKA8-uButTYQ6MRtIC0h0F5SnLi0eoML53pOI_FI8ijoPr3zNgS3GjQjBDtTNk5anTF1MPWmUvyw3FSOmuFq8rQwgk2Jd3Z8Xlzyjae0Sy-LC_Hu_k9FWNYbjLrHng1iH-_2/s1600/17.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="209" data-original-width="363" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWK-fQt3MpCKA8-uButTYQ6MRtIC0h0F5SnLi0eoML53pOI_FI8ijoPr3zNgS3GjQjBDtTNk5anTF1MPWmUvyw3FSOmuFq8rQwgk2Jd3Z8Xlzyjae0Sy-LC_Hu_k9FWNYbjLrHng1iH-_2/s1600/17.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKO-sInYwLKrKD-QbMO5Js5JMrhwNYcYAOmQyUiIEG7XaPV3Xn1xCizHEcPEf2arvL9mn0J2kSog27uL3rcJs4kz0s5sTrKYA_zqSiV05Te04ngCXbhZZv7eMxO1Zt5vVOzthne9rMU_R9/s1600/18.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="498" data-original-width="1188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKO-sInYwLKrKD-QbMO5Js5JMrhwNYcYAOmQyUiIEG7XaPV3Xn1xCizHEcPEf2arvL9mn0J2kSog27uL3rcJs4kz0s5sTrKYA_zqSiV05Te04ngCXbhZZv7eMxO1Zt5vVOzthne9rMU_R9/s1600/18.jpg" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOgtYCPINtXNRRcCTWdHaCE4knHmd4Cy03w6rqj0Jo3OYfJWdPP89gqgpxLe-wmRF4icOAhkgZpri99RCgppS7_yhsp3K6wFbVUFZL3iyYg1Wczg8GzkRrxJu-Bz4YFRf1RDxf-COnbuYu/s1600/19.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="246" data-original-width="347" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOgtYCPINtXNRRcCTWdHaCE4knHmd4Cy03w6rqj0Jo3OYfJWdPP89gqgpxLe-wmRF4icOAhkgZpri99RCgppS7_yhsp3K6wFbVUFZL3iyYg1Wczg8GzkRrxJu-Bz4YFRf1RDxf-COnbuYu/s1600/19.jpg" /></a></div>
Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-13199615799098731872017-05-01T01:05:00.001-07:002017-05-01T01:05:37.180-07:00SQL - Calculate time difference in Minutes, Hours, Days, Weeks, Months, Years for Posts / Notification<br />
In this post I will show you how you can easily calculate time difference between two dates in seconds, minutes, hours, days, and even weeks, months and years in SQL. <br />
<br />
This functionality can be used in notifications, emails, blog post etc<br />
<br />
The key of this calculation is in Modulo operator, %. It returns the remainder (NOT the result!) of one number divided by another!<br />
<br />
<br />
<pre class="brush: sql">CREATE FUNCTION [dbo].[FN_GetTimeDifference] (@FromDate DATETIME, @ToDate DATETIME)
RETURNS NVARCHAR(50)
AS
BEGIN
DECLARE @Result NVARCHAR(50)
SELECT @Result = CASE WHEN DATEDIFF(second, @FromDate, @ToDate) / 60 / 60 / 24 / 7 > 0 THEN CAST(DATEDIFF(second, @FromDate, @ToDate) / 60 / 60 / 24 / 7 AS NVARCHAR(50)) + ' weeks ago'
WHEN DATEDIFF(second, @FromDate, @ToDate) / 60 / 60 / 24 % 7 > 0 THEN CAST(DATEDIFF(second, @FromDate, @ToDate) / 60 / 60 / 24 % 7 AS NVARCHAR(50)) + ' days ago'
WHEN DATEDIFF(second, @FromDate, @ToDate) / 60 / 60 % 24 > 0 THEN CAST(DATEDIFF(second, @FromDate, @ToDate) / 60 / 60 % 24 AS NVARCHAR(50)) + ' hrs ago'
WHEN DATEDIFF(second, @FromDate, @ToDate) / 60 % 60 > 0 THEN CAST(DATEDIFF(second, @FromDate, @ToDate) / 60 % 60 AS NVARCHAR(50)) + ' min ago'
WHEN DATEDIFF(second, @FromDate, @ToDate) % 60 > 0 THEN CAST(DATEDIFF(second, @FromDate, @ToDate) % 60 AS NVARCHAR(50)) + ' sec ago'
END
RETURN @Result
END
</pre>
<br />
<br />
<br />
Following is the usage and the expected output of the above function. In most of the cases we need to use GETDATE() as @ToDate parameter.<br />
<br />
<br />
<pre class="brush: sql">-----------------------------------------------------------------------------
SELECT dbo.FN_GetTimeDifference('2017-05-01 11:58:00', '2017-05-01 11:58:08')
8 sec ago
-----------------------------------------------------------------------------
SELECT dbo.FN_GetTimeDifference('2017-05-01 11:30:00', '2017-05-01 11:58:08')
28 min ago
-----------------------------------------------------------------------------
SELECT dbo.FN_GetTimeDifference('2017-05-01 02:58:00', '2017-05-01 11:58:08')
9 hrs ago
-----------------------------------------------------------------------------
SELECT dbo.FN_GetTimeDifference('2017-04-30 11:58:00', '2017-05-01 11:58:08')
1 days ago
-----------------------------------------------------------------------------
SELECT dbo.FN_GetTimeDifference('2017-04-15 11:58:00', '2017-05-01 11:58:08')
2 weeks ago
-----------------------------------------------------------------------------
</pre>
<br />
<br />Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com1tag:blogger.com,1999:blog-3469460527526008570.post-21407607936098678222017-04-21T13:24:00.001-07:002017-04-21T13:39:40.841-07:00Pass multiple complex objects to Web API actionWorking with ASP.NET Web API, the most unexpected thing is the limited support of POST data values to simple ApiController methods. <br />
<br />
When a parameter has [FromBody], Web API uses the Content-Type header to select a formatter. At most one parameter is allowed to read from the message body. The reason for this rule is that the request body might be stored in a non-buffered stream that can only be read once.<br />
<br />
A simple principle, you can send any content in HTTP request, it only need to be serializable into a string. So, it could be multiple JSON object. In this example, the content type is "application/json" and the request body is a raw JSON string (not a JSON object).<br />
<br />
Here I found a workaround to pass multiple complex objects (using the above principle) from jquery to a WEB API using <a href="http://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_Linq_JObject.htm">JObject</a>, and then cast back to your required specific object type in api controller. This objects provides a concrete type specifically designed for working with JSON.<br />
<br />
<pre class="brush: jscript ">var customer = {
"Name": "jhon",
"Id": 1,
};
var product = {
"Name": "table",
"CategoryId": 5,
"Count": 100
};
var employee = {
"Name": "Fatih",
"Id": 4,
};
var combinedObj = {};
combinedObj["obj1"] = customer;
combinedObj["obj2"] = product;
combinedObj["obj3"] = employee;
$.ajax({
type: 'POST',
async: true,
url: 'api/PostGenericObjects/',
data: JSON.stringify(combinedObj),
success: function (response) {
console.log("Response Data ↓");
console.log(response);
},
error: function (err) {
console.log(err);
}
});
</pre><br />
<br />
and then you can get this object in your ApiController<br />
<br />
<pre class="brush: csharp">using Newtonsoft.Json.Linq;
public string PostGenericObjects(object obj)
{
string[] str = GeneralMethods.UnWrapObjects(obj);
var customer = JsonConvert.DeserializeObject<Customer>(str[0]);
var product = JsonConvert.DeserializeObject<Product>(str[1]);
var employee = JsonConvert.DeserializeObject<Employee>(str[2]);
//... other work....
}
</pre><br />
I have made a generic function to unwrap the complex object, so there is no limitation of number of objects while sending and unwrapping. We can even send more than two objects<br />
<br />
<pre class="brush: csharp">public class GeneralMethods
{
public static string[] UnWrapObjects(object obj)
{
JObject o = JObject.Parse(obj.ToString());
string[] str = new string[o.Count];
for (int i = 0; i < o.Count; i++)
{
string var = "obj" + (i + 1).ToString();
str[i] = o[var].ToString();
}
return str;
}
}
</pre><br />
<br />
<br />
I hope it would help someone. I would be interested to hear from the experts here regarding the pros and cons of using this methodology. Do share your feedback. <br />
<br />
Happy Coding!<br />
<br />
<br />
Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-75297161740776037682012-11-02T17:08:00.001-07:002017-12-06T23:02:26.696-08:00Call User-defined Function on Linked Server :SQL Server<br />
<br />
<div><span style="line-height: 1.3;"><br />
</span></div><div><div><span style="line-height: 20px;">If you try to invoke a user-defined function (UDF) through a linked server in SQL Server by using a "four-part naming" convention (server.database.dbo.Function), you may receive error message. </span></div><div><span style="line-height: 20px;"><br />
</span></div><div><span style="line-height: 20px;">The reason is User-defined function calls inside a four-part linked server query are not supported in SQL Server. Thats why error message indicates that the syntax of a Transact-SQL statement is incorrect. </span></div><div><span style="line-height: 20px;"><br />
</span></div><div><span style="line-height: 20px;">To work around this problem, use the Openquery function instead of the four-part naming convention. For example, instead of the following query</span></div><div><span style="line-height: 20px;"><br />
</span></div><div><pre class="brush: sql" style="line-height: 20px;">Select * from Linked_Server.database.dbo.Function(10)
</pre></div><div><span style="line-height: 20px;"><br />
</span></div><div><span style="line-height: 20px;">run a query with the Openquery function:</span></div><div><span style="line-height: 20px;"><br />
</span></div><div><pre class="brush: sql " style="line-height: 20px;">Select * from Openquery(Linked_Server,'select database.dbo.Function(10)')
</pre></div></div><div><span style="line-height: 20px;">If the user-defined function takes variable or scalar parameters, you can use the sp_executesql stored procedure to avoid this behavior. </span></div><div><span style="line-height: 20px;">For example:</span></div><div><span style="line-height: 20px;"><br />
</span></div><div><pre class="brush: sql " style="line-height: 20px;">exec Linked_Server.database.dbo.sp_executesql N'SELECT
database.dbo.Function(@input)',N'@input int',@input=10
</pre></div><div><span style="line-height: 20px;">but if you want to use it in a select statement (within some Stored Procedure), then this EXEC command will create some problems for you :)</span></div><div><span style="line-height: 20px;">However this could be resolve easily by creating a user-defined function in your database (not the linked server one)</span></div><div><span style="line-height: 20px;"><br />
</span></div><pre class="brush: sql " style="line-height: 20px;">CREATE FUNCTION [dbo].Function_Name(@Parameter INT)
RETURNS VARCHAR(8000)
AS
BEGIN
DECLARE @word sysname
EXEC LinkedServer.DatabaseName.dbo.sp_executesql
N'SELECT DatabaseName.dbo.Function_Name(@Parameter)' --dynamic sql query to execute
,N'@Parameter int' --parameter definitions
,@Parameter=@word OUTPUT --assigning the caller procs local variable to the dynamic parameter
RETURN @word
END
</pre><br />
<br />
In order to run the above function, you have set RPC Out value of that particular linked server to be True.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61pAJxM-wwHZFnR5RpvwnB-YJmthk-nDDpiJA6oGaKfg9r1EpCdzUu2W_jb_ur6eSohku-MINR5qouf32Tl5fPq5gnlxuv5bpzRQPmczK_SEkUrqP3nf8il1clORZRGn3EPFXE-nHV5hk/s1600/rpc-out.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi61pAJxM-wwHZFnR5RpvwnB-YJmthk-nDDpiJA6oGaKfg9r1EpCdzUu2W_jb_ur6eSohku-MINR5qouf32Tl5fPq5gnlxuv5bpzRQPmczK_SEkUrqP3nf8il1clORZRGn3EPFXE-nHV5hk/s1600/rpc-out.jpg" data-original-width="1031" data-original-height="378" /></a></div>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com10tag:blogger.com,1999:blog-3469460527526008570.post-22432738327260738582011-01-30T06:38:00.001-08:002011-01-30T18:52:57.995-08:00Delete Duplicate Rows in SQL Server 2005A new addition to the DELETE command in SQL Server 2005 is the TOP statement. The DELETE TOP does the same thing as a SELECT TOP WHERE only the TOP number of rows are deleted. This can be very helpful when there are duplicate rows of data present. <br />
<pre class="brush: sql">DELETE TOP (1)
FROM Sales.Customer
WHERE CustomerID = 1
</pre><br />
<br /><br />
This would delete one of the duplicate rows for Customer number 1 Suppose somehow the whole customer table got duplicated. I duplicated the Sales.Customer table into a tmpCustomer table.<br />
<br /><br />
<pre class="brush: sql ">SELECT Top 1 CustomerID, COUNT(CustomerID) AS Cnt
FROM tmpCustomer
GROUP BY CustomerID
HAVING COUNT(CustomerID) > 1
WHILE @@RowCount > 0
BEGIN
DELETE Top (1)
FROM tmpCustomer
WHERE CustomerID = (SELECT Top (1) CustomerID
FROM tmpCustomer
GROUP BY CustomerID
HAVING COUNT(CustomerID) > 1)
END
</pre><br /><br />
<br />
While this worked just fine, it ran about 4 minutes for 38K rows. Let's try the dreaded CURSOR. Notice I can stick a variable in where the TOP () statement is. I subtracted -1 because we don't want to delete every row. <br />
<br />
<br /><br />
<pre class="brush: sql ">DECLARE @cnt int, @custID as int
DECLARE dupCursor CURSOR FAST_FORWARD
FOR SELECT CustomerID, COUNT(CustomerID) AS Cnt
FROM tmpCustomer
GROUP BY CustomerID
HAVING COUNT(CustomerID) > 1
OPEN dupCursor
FETCH NEXT FROM dupCursor
INTO @custID, @cnt
WHILE @@FETCH_STATUS = 0
BEGIN
DELETE Top (@cnt-1)
FROM tmpCustomer
WHERE CustomerID = @custID
FETCH NEXT FROM dupCursor
INTO @custID, @cnt
END
CLOSE dupCursor
DEALLOCATE dupCursor
</pre><br />
<br /><br />
This ran much better at 18 seconds. Enjoy.<br />
<br />
<br />Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-62741742063232859012010-09-02T00:28:00.000-07:002017-02-11T21:19:37.376-08:00jQuery Image Swap with Effects<br />
Swapping one image with another is probably one of the most used javascript techniques. Also Dreamweaver made “Image Replacement” even easier for non HTML/Javascript programmers by including this feature out of the box. One thing about Dreamweaver’s image swapping javascript is that it’s not the most beautiful javascript code. Well, as always with anything javascript related, jQuery is to the rescue. Query makes dynamic image swapping a peace of cake. <br />
Firstly you have to copy the following javascript code in the HEAD section of your page. You can also save the following javascript functions in a seperate js file. <br />
<pre class="brush: jscript"> <script type="text/javascript" src="https://code.jquery.com/jquery.js"></script>
</pre><br />
<br />
<pre class="brush: jscript">(function($) {
$.fn.innerfade = function(options) {
return this.each(function() {
$.innerfade(this, options);
});
};
$.innerfade = function(container, options) {
var settings = {
'animationtype': 'fade',
'speed': 'fast',
'type': 'sequence',
'timeout': 2000,
'containerheight': 'auto',
'runningclass': 'innerfade',
'children': null
};
if (options)
$.extend(settings, options);
if (settings.children === null)
var elements = $(container).children();
else
var elements = $(container).children(settings.children);
if (elements.length > 1) {
$(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass);
for (var i = 0; i < elements.length; i++) {
$(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').hide();
};
if (settings.type == "sequence") {
setTimeout(function() {
$.innerfade.next(elements, settings, 1, 0);
}, settings.timeout);
$(elements[0]).show();
} else if (settings.type == "random") {
var last = Math.floor ( Math.random () * ( elements.length ) );
setTimeout(function() {
do {
current = Math.floor ( Math.random ( ) * ( elements.length ) );
} while (last == current );
$.innerfade.next(elements, settings, current, last);
}, settings.timeout);
$(elements[last]).show();
} else if ( settings.type == 'random_start' ) {
settings.type = 'sequence';
var current = Math.floor ( Math.random () * ( elements.length ) );
setTimeout(function(){
$.innerfade.next(elements, settings, (current + 1) % elements.length, current);
}, settings.timeout);
$(elements[current]).show();
} else {
alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
}
}
};
$.innerfade.next = function(elements, settings, current, last) {
if (settings.animationtype == 'slide') {
$(elements[last]).slideUp(settings.speed);
$(elements[current]).slideDown(settings.speed);
} else if (settings.animationtype == 'fade') {
$(elements[last]).fadeOut(settings.speed);
$(elements[current]).fadeIn(settings.speed, function() {
removeFilter($(this)[0]);
});
} else
alert('Innerfade-animationtype must either be \'slide\' or \'fade\'');
if (settings.type == "sequence") {
if ((current + 1) < elements.length) {
current = current + 1;
last = current - 1;
} else {
current = 0;
last = elements.length - 1;
}
} else if (settings.type == "random") {
last = current;
while (current == last)
current = Math.floor(Math.random() * elements.length);
} else
alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
setTimeout((function() {
$.innerfade.next(elements, settings, current, last);
}), settings.timeout);
};
})(jQuery);
// **** remove Opacity-Filter in ie ****
function removeFilter(element) {
if(element.style.removeAttribute){
element.style.removeAttribute('filter');
}
}
$(document).ready(
function(){
$('ul#gallery').innerfade({
speed: 800,
timeout: 4000,
type: 'sequence',
containerheight: '220px'
});
});
</pre>
Now Inside Body Tag, Copy paste the following code. You can replace the image src with your own :)
<pre class="brush: xml"> <div id="slider"> <ul id="gallery" style="list-style-type: none;"><li> <img src="Image1.jpg" alt="" /></li>
<li> <img src="Image2.jpg" alt="" /></li>
<li> <img src="Image3.jpg" alt="" /></li>
<li> <img src="Image4.jpg" alt="" /></li>
<li> <img src="Image5.jpg" alt="" /></li>
</ul></div></pre>
Thats is! You are done.
<b>Thanks for viewing :)</b>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-27424453991405069942010-07-14T01:11:00.000-07:002010-07-14T01:11:45.929-07:00SQL Bulk Copy with C#.Net<div style="font-family: verdana; font-size: small;"><span style="font-family: Verdana; font-size: x-small;">Bulk copying of data from one data source to another data source is a new feature added to ADO.NET 2.0. Bulk copy classes provides the fastest way to transfer set of data from once source to the other.</span></div><div style="font-family: verdana; font-size: small;"><span style="font-family: Verdana; font-size: x-small;">Each ADO.NET data provider provides bulk copy classes. For example, in SQL .NET data provider, the bulk copy operation is handled by SqlBulkCopy class, which is described in Figure 1. As you can see from Figure 1, data from a data source can be copied to one of the four types - DataReader, DataSet, DataTable, or XML.</span></div><div style="font-family: verdana; font-size: small;"><span style="font-family: Verdana; font-size: x-small;"><br />
</span></div><div style="font-family: verdana; font-size: small;"><span style="font-family: Verdana; font-size: x-small;"><br />
</span></div><div class="separator" style="clear: both; text-align: center;"></div><div style="margin-left: 1em; margin-right: 1em;"><img align="baseline" alt="" border="0" hspace="0" src="http://www.csharpcorner.com/UploadFile/mahesh/BulckCopyAdoNet2008192005135138PM/Images/BulkCopyIm1.gif" /></div><div style="margin-left: 1em; margin-right: 1em;"><br />
</div><br />
<div style="font-family: verdana; font-size: small;"><span style="font-family: Verdana; font-size: x-small;"><span class="Apple-style-span" style="font-family: verdana;"></span></span></div><span style="font-family: Verdana; font-size: x-small;"><div style="text-align: center;"><span style="font-family: Verdana; font-size: x-small;">Figure 1. Bulk Copy operation in ADO.NET 2.0</span></div><div style="text-align: center;"><span style="font-family: Verdana; font-size: x-small;"><br />
</span></div><span style="font-family: Verdana; font-size: x-small;">Using bulk copy operation, you can transfer data between two tables on the same SQL Server, between two different SQL Servers, or even two different types of database servers.</span><br />
<span style="font-family: Verdana; font-size: x-small;"><br />
</span></span><br />
<br />
<br />
<br />
<pre class="brush: csharp">
using System.Data.SqlClient;
public static void CopyData(DataTable sourceTable, SqlConnection destConnection, SqlTransaction destTrans, string destTableName)
{
// new method: SQLBulkCopy:
using (SqlBulkCopy s = new SqlBulkCopy(destConnection, SqlBulkCopyOptions.Default, destTrans))
{
s.DestinationTableName = destTableName;
s.NotifyAfter = 40000;
//s.SqlRowsCopied += new SqlRowsCopiedEventHandler(s_SqlRowsCopied);
s.WriteToServer(sourceTable);
s.Close();
}
}
</pre><br />
<br />
<br />
Calling the above function<br />
<br />
<pre class="brush: csharp"> SqlConnection destinationConnection= new SqlConnection(sourceConnectionString);
destinationConnection.Open();
destinationTransaction = destinationConnection.BeginTransaction(IsolationLevel.ReadUncommitted);
DataTable SourceDataTable= new DataTable();
CopyData(SourceDataTable, destinationConnection, destinationTransaction, "DestinationTableName");
destinationTransaction.Commit();
destinationConnection.Close();
</pre>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-72372091272597573292010-07-06T06:32:00.000-07:002011-07-22T01:36:07.866-07:00ASP.NET DropDownList with OptionGroup support<span class="Apple-style-span" style="font-family: Verdana, Arial, sans-serif; font-size: 13px; line-height: 16px;"></span><br />
<div style="font-family: Verdana, Arial, sans-serif; font-size: 10pt; line-height: 1.2em;">ASP.NET 2.0, for all its bells and whistles, lacks the odd bit of functionality for reasons completely unknown. One such notable omission is that of OptionGroup <code lang="html" style="color: #990000; font: normal normal normal 11pt/normal 'Courier New', Courier, mono;">(<span class="code-keyword" style="color: blue;"><</span><span class="code-leadattribute" style="color: maroon;">optgroup</span><span class="code-keyword" style="color: blue;">></span></code>) support in the <code style="color: #990000; font: normal normal normal 11pt/normal 'Courier New', Courier, mono;">DropDownList</code> control. For those unfamiliar with the <code lang="html" style="color: #990000; font: normal normal normal 11pt/normal 'Courier New', Courier, mono;"><span class="code-keyword" style="color: blue;"><</span><span class="code-leadattribute" style="color: maroon;">optgroup</span><span class="code-keyword" style="color: blue;">></span></code> element, it is part of the XHTML standard, and has the effect of categorising items in a <code lang="html" style="color: #990000; font: normal normal normal 11pt/normal 'Courier New', Courier, mono;"><span class="code-keyword" style="color: blue;"><</span><span class="code-leadattribute" style="color: maroon;">select</span><span class="code-keyword" style="color: blue;">></span></code>, as the following image shows.</div><div style="font-family: Verdana, Arial, sans-serif; font-size: 10pt; line-height: 1.2em;"><br />
</div><div style="font-family: Verdana, Arial, sans-serif; font-size: 10pt; line-height: 1.2em;"><img alt="Option Groups" height="175" src="http://www.codeproject.com/KB/custom-controls/DropDownListOptionGroup/dropdownlist_optiongroup.gif" style="overflow-x: auto; overflow-y: auto;" width="148" /></div><div style="font-family: Verdana, Arial, sans-serif; font-size: 10pt; line-height: 1.2em;"><br />
</div><div style="font-family: Verdana, Arial, sans-serif; font-size: 10pt; line-height: 1.2em;">Control Adapters are new in ASP.NET 2.0, and allow the developer to override the rendering behavior of any control, very powerful stuff! Furthermore, Control Adapters are used in conjunction with a browser file, so specific browsers may be targeted, if required. Armed with that knowledge, the solution became simple. The attached download contains the requisite files to implement this solution in your own projects, but for posterity, I paste it here also.</div><br />
<pre class="brush: csharp">public class DropDownListAdapter :
System.Web.UI.WebControls.Adapters.WebControlAdapter {
protected override void RenderContents(HtmlTextWriter writer) {
DropDownList list = this.Control as DropDownList;
string currentOptionGroup;
List<string> renderedOptionGroups = new List<string>();
foreach(ListItem item in list.Items) {
if(item.Attributes["OptionGroup"] == null) {
RenderListItem(item, writer);
} else {
currentOptionGroup = item.Attributes["OptionGroup"];
if(renderedOptionGroups.Contains(currentOptionGroup)) {
RenderListItem(item, writer);
} else {
if(renderedOptionGroups.Count > 0) {
RenderOptionGroupEndTag(writer);
}
RenderOptionGroupBeginTag(currentOptionGroup,
writer);
renderedOptionGroups.Add(currentOptionGroup);
RenderListItem(item, writer);
}
}
}
if(renderedOptionGroups.Count > 0) {
RenderOptionGroupEndTag(writer);
}
}
private void RenderOptionGroupBeginTag(string name,
HtmlTextWriter writer) {
writer.WriteBeginTag("optgroup");
writer.WriteAttribute("label", name);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteLine();
}
private void RenderOptionGroupEndTag(HtmlTextWriter writer) {
writer.WriteEndTag("optgroup");
writer.WriteLine();
}
private void RenderListItem(ListItem item,
HtmlTextWriter writer) {
writer.WriteBeginTag("option");
writer.WriteAttribute("value", item.Value, true);
if(item.Selected) {
writer.WriteAttribute("selected", "selected", false);
}
foreach(string key in item.Attributes.Keys) {
writer.WriteAttribute(key, item.Attributes[key]);
}
writer.Write(HtmlTextWriter.TagRightChar);
HttpUtility.HtmlEncode(item.Text, writer);
writer.WriteEndTag("option");
writer.WriteLine();
}
}
</string></string>
</pre><pre class="brush: csharp"></pre><br />
Also, you have to hook it up using a .browserfile in your project. My browser file was named "<b>App_Browsers\BrowserFile.browser</b>" and looked like this:<br />
<br />
You can find existing browser definitions at<br />
<b>[windir]\Microsoft.NET\Framework\[ver]\CONFIG\Browsers</b><br />
<br />
<pre class="brush: xml"><browsers>
<browser refid="Default">
<controladapters>
<adapter adaptertype="DropDownListAdapter" controltype="System.Web.UI.WebControls.DropDownList">
</adapter></controladapters>
</browser>
</browsers>
</pre><br />
<b>Binding DropDown List from DataTable</b><br />
<br />
<pre class="brush: xml"><asp:dropdownlist id="Select_DDL" runat="server" width="100%">
<asp:listitem>Select</asp:listitem>
</asp:dropdownlist>
</pre><br />
<br />
<pre class="brush: csharp">void BindDropDownList()
{
Select_DDL.DataTextField = "DDL_Name";
Select_DDL.DataValueField = " DDL _Code";
Select_DDL.DataSource = dsAllData.Tables[1];
Select_DDL.DataBind();
string optionGroup = string.Empty;
for (int i = 0; i < dsAllData.Tables[1].Rows.Count; i++)
{
if (dsAllData.Tables[1].Rows[i]["parent"].ToString() == "0")
optionGroup = dsAllData.Tables[1].Rows[i]["Product_Name"].ToString();
Select_DDL.Items[i].Attributes["OptionGroup"] = optionGroup;
}
int count = Select_DDL.Items.Count;
for (int i = count - 1; i >= 0; i--)
{
if (dsAllData.Tables[1].Rows[i]["parent"].ToString() == "0")
{
Select_DDL.Items.RemoveAt(i);
}
}
}
</pre>
<br />
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://developersmania.blogspot.com/" num_posts="5" width="500"></fb:comments>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-32180674578671537422010-07-06T05:28:00.000-07:002010-07-06T05:49:48.752-07:00Configure IP Address and Other Network Information in Windows 7<h2 style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; text-align: center;">Configure IP Address and Other Network Information in Windows 7</h2><div><br />
</div><div><div style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px;">Let me show you how to configure IP address and other network information in Windows 7 here. As you know IP address must be configured on computer in order to communicate with other computers, because this IP address is the standard address understood by computers and other networking devices in networking world.</div><div style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px;">You can configure IP address, subnet mask, gateway and DNS servers manually on computer, but you can also configure computer to obtain IP address and other network information from DHCP server (most of the time is configured on router).</div><div style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px;"><br />
</div><div style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px;"></div>Without wasting any more time, let me show you quick way to do it:<br />
1) Go to <b>Start</b> and click on <b>Control Panel</b>.<br />
2) Proceed to click <b>View network status and tasks</b> in Control Panel window.<br />
<br />
<left><img alt="windows 7 view network status and tasks" border="0" src="http://www.home-network-help.com/images/windows-7-view-network-status-and-tasks.jpg" /></left><br />
<left><br />
</left><br />
3) Network and Sharing Center window will appear, then click <b>change adapter settings</b>.<br />
<br />
<left><img alt="change adapter settings in Windows 7" border="0" src="http://www.home-network-help.com/images/change-adapter-settings-in-windows-7.jpg" /></left><br />
<left><br />
</left><br />
4) Network Connections window will appears. Here you can right click on the <b>network adapter</b> (can be wireless adapter or wired Ethernet adapter) that you wish to configure and click <b>Properties</b>.<br />
<br />
<left><img alt="Windows 7 network adapter properties" border="0" src="http://www.home-network-help.com/images/windows-7-network-adapter-properties.jpg" /></left><br />
<left><br />
</left><br />
5) In the Network Connection Properties window, tick on <b>Internet Protocol Version 4 (TCP/IPv4)</b> and click <b>Properties</b>.<br />
<br />
<b>Note:</b> If your computer sits in IPv6 network, you can select <b>Internet Protocol Version 6 (TCP/IPv6)</b> to configure IPv6 address, but it’s not covered here.<br />
<br />
<left><img alt="network adapter IPv4 properties" border="0" src="http://www.home-network-help.com/images/network-adapter-ipv4-properties.jpg" /></left><br />
<br />
<h2>Manual IP Assigning</h2><br />
If you wanna do manual configuration, you can now key in the <b>IP address, Subnet mask, Default gateway and DNS servers</b>.<br />
<b>Note:</b> IP address of your computer must be unique. None of the 2 computers in the same network can share same IP address, because it will cause IP address conflict.<br />
<b>Note:</b> Default gateway is a router that can route the traffic to the other network or Internet. DNS server is an application server that can translate URL to IP address. Check with your ISP on what DNS servers you should use. If not, you can try this free <a href="http://www.home-network-help.com/opendns.html">Opendns</a> or <a href="http://www.home-network-help.com/dns-servers.html">Google DNS</a> servers.<br />
<br />
<left><img alt="manual IP configuration Windows 7" border="0" src="http://www.home-network-help.com/images/manual-ip-configuration-windows-7.jpg" /></left><br />
<br />
<h2>IP Assigned by DHCP server</h2><br />
If you have DHCP server setup on your router or you have dedicated DHCP server, your computer can be assigned IP address and other network information automatically by selecting <b>Obtain an IP address automatically</b> and <b>Obtain DNS server address automatically</b>.<br />
<br />
<left><img alt="automatic IP configuration Windows 7" border="0" src="http://www.home-network-help.com/images/automatic-ip-configuration-windows-7.jpg" /></left><br />
<left><br />
</left><br />
<b>Note:</b> If you have a notebook, and you use static IP at home and the IP assigned by DHCP server at the office, you can make use of <b>alternate configuration</b> to set IP and network information for these 2 different networks.<br />
<br />
Set <b>Obtain an IP address and DNS automatically</b> on General tab as according to what I specified above, so that the notebook will be assigned IP addresses automatically at the office. After that, click <b>Alternate Configuration</b> tab, select User configured option and key in your home network’s static IP and other network information. By setting this, when there is no IP information assigned due to no DHCP server at home, this alternate configuration will be applied automatically, so that you don’t have to spend time on configuring IP manually every time at home.<br />
<br />
<left><img alt="alternate IP configuration in Windows 7" border="0" src="http://www.home-network-help.com/images/alternate-ip-configuration-in-windows-7.jpg" /></left><br />
<left><br />
</left><br />
<left><br />
</left></div>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-29637191524757803132010-07-02T00:34:00.000-07:002010-07-02T00:38:38.399-07:00Running 32-bit Server Applications on 64-bit Machines<div style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; line-height: normal;"></span></div><h1 style="color: black; font-family: Arial, Helvetica, sans-serif; font-size: 21px; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 12px;">Running 32-bit Applications on 64-bit Windows (IIS 6.0)</h1><br />
<div style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Windows Server 2003™, Service Pack 1 enables IIS 6.0 to run 32-bit Web applications on 64-bit Windows using the Windows-32-on-Windows-64 (WOW64) compatibility layer. IIS 6.0 using WOW64 is intended to run 32-bit personal productivity applications needed by software developers and administrators, including 32-bit Internet Information Services (IIS) Web applications.</div><div style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">On 64-bit Windows, 32-bit processes cannot load 64-bit DLLs, and 64-bit processes cannot load 32-bit DLLs. If you plan to run 32-bit applications on 64-bit Windows, you must configure IIS to create 32-bit worker processes. Once you have configured IIS to create 32-bit worker processes, you can run the following types of IIS applications on 64-bit Windows:</div><table border="0" cellpadding="0" cellspacing="0" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;"><tbody>
<tr><td class="listBullet" style="color: #a6a6a6; font-size: 19px;" valign="top">•</td><td class="listItem" style="padding-bottom: 0em; padding-left: 0.5em; padding-right: 0em; padding-top: 0em;"><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Internet Server API (ISAPI) extensions</div></td></tr>
<tr><td class="listBullet" style="color: #a6a6a6; font-size: 19px;" valign="top">•</td><td class="listItem" style="padding-bottom: 0em; padding-left: 0.5em; padding-right: 0em; padding-top: 0em;"><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">ISAPI filters</div></td></tr>
<tr><td class="listBullet" style="color: #a6a6a6; font-size: 19px;" valign="top">•</td><td class="listItem" style="padding-bottom: 0em; padding-left: 0.5em; padding-right: 0em; padding-top: 0em;"><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Active Server Page (ASP) applications (specifically, scripts calling COM objects where the COM object can be 32-bit or 64-bit)</div></td></tr>
<tr><td class="listBullet" style="color: #a6a6a6; font-size: 19px;" valign="top">•</td><td class="listItem" style="padding-bottom: 0em; padding-left: 0.5em; padding-right: 0em; padding-top: 0em;"><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">ASP.NET applications</div></td></tr>
</tbody></table><div style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">IIS can, by default, launch Common Gateway Interface (CGI) applications on 64-bit Windows, because CGI applications run in a separate process.</div><div style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><br />
</div><div style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; line-height: normal;"></span></div><h2 style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 15px; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 4px; padding-left: 0px; padding-right: 0px; padding-top: 8px;">Configuring IIS to run 32-bit Web applications on 64-bit Windows</h2><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Before you configure IIS to run 32-bit applications on 64-bit Windows, note the following:</div><table border="0" cellpadding="0" cellspacing="0"><tbody>
<tr><td class="listBullet" style="color: #a6a6a6; font-size: 19px;" valign="top">•</td><td class="listItem" style="padding-bottom: 0em; padding-left: 0.5em; padding-right: 0em; padding-top: 0em;"><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">IIS only supports 32-bit worker processes in Worker Process Isolation mode on 64-bit Windows.</div></td></tr>
<tr><td class="listBullet" style="color: #a6a6a6; font-size: 19px;" valign="top">•</td><td class="listItem" style="padding-bottom: 0em; padding-left: 0.5em; padding-right: 0em; padding-top: 0em;"><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">On 64-bit Windows, the World Wide Web Publishing service can run 32-bit and 64-bit worker processes. Other IIS services like the IIS Admin service, the SMTP service, the NNTP service, and the FTP service run 64-bit processes only.</div></td></tr>
<tr><td class="listBullet" style="color: #a6a6a6; font-size: 19px;" valign="top">•</td><td class="listItem" style="padding-bottom: 0em; padding-left: 0.5em; padding-right: 0em; padding-top: 0em;"><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;">On 64-bit Windows, the World Wide Web Publishing service does not support running 32-bit and 64-bit worker processes concurrently on the same server.</div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><a href="http://www.amazon.com/Microsoft-Administrators-Pocket-Consultant-Administrators/dp/0735615608?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Microsoft IIS 6.0 Administrator's Pocket Consultant (IT-Administrator's Pocket Consultant)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=0735615608&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=0735615608" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/Windows-Ultimate-64-bit-System-Builders/dp/B0015CCG4U?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Windows Vista Ultimate with SP1 64-bit for System Builders - 1 pack" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B0015CCG4U&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B0015CCG4U" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/FIFA-Soccer-10-Playstation-3/dp/B002BCVFRM?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="FIFA Soccer 10" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B002BCVFRM&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B002BCVFRM" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/Windows-PRO-Bit-OEM-1pk/dp/B002NGJNZM?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Windows 7 PRO 32 Bit OEM 1pk" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B002NGJNZM&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B002NGJNZM" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /></div><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1em; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-outline-level: 2;"><b><span style="color: black; font-family: Verdana, sans-serif; font-size: 11.5pt;">To enable IIS 6.0 to run 32-bit applications on 64-bit Windows<o:p></o:p></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><br />
</div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">1. Enable IIS's 32-bit support</span></b><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">Open a command prompt and type in the following command:<o:p></o:p></span></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><i style="mso-bidi-font-style: normal;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1<o:p></o:p></span></i></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">This command enables the 32-bit mode in IIS.<o:p></o:p></span></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">2. Install the IIS 32-bit extensions</span></b><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;"><o:p></o:p></span></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">Open a command prompt and type the following command:<o:p></o:p></span></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><i style="mso-bidi-font-style: normal;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i<o:p></o:p></span></i></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">This command installs the 32-bit web extensions for .NET Framework 2.0.<o:p></o:p></span></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">3. Activate .NET Framework 2.0 32-bit in IIS<o:p></o:p></span></b></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">In the IIS-Manager, select the 'ASP.NET v2.0.50727 (32bit)' in the <b style="mso-bidi-font-weight: normal;"><i style="mso-bidi-font-style: normal;">'Web Service Extensions'</i></b> panel and check 'allow' to activate it.<o:p></o:p></span></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><b style="mso-bidi-font-weight: normal;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">4. Restart the IIS by opening a command prompt:<o:p></o:p></span></b></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><span style="color: black; font-family: Verdana, sans-serif; font-size: 8.5pt;">iisrestart<o:p></o:p></span></div><div class="MsoNormal" style="line-height: 14.25pt; margin-bottom: 6.0pt;"><br />
</div></td></tr>
</tbody></table>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-46699043442633076542010-06-25T13:07:00.000-07:002010-06-25T13:07:08.310-07:00Show Current Time via JavaScript<br/><br />
<div style="font-family: Georgia,"Times New Roman",serif;">This Code will show client side current time. </div><div style="font-family: Georgia,"Times New Roman",serif;"><br />
</div><span style="font-family: Georgia,"Times New Roman",serif;">You just have create a div with a JavaScript function call as shown below.</span><br />
<br />
<br />
<pre class="brush: xml"><div id="js_clock">js_clock();
</div></pre><br />
<u><b>JavaScript Function:</b></u><br />
<br />
<pre class="brush: jscript">function js_clock()
{
var clock_time = new Date();
var clock_hours = clock_time.getHours();
var clock_minutes = clock_time.getMinutes();
var clock_seconds = clock_time.getSeconds();
var clock_suffix = "AM";
if (clock_hours > 11)
{
clock_suffix = "PM";
clock_hours = clock_hours - 12;
}
if (clock_hours == 0)
{
clock_hours = 12;
}
if (clock_hours < 10)
{
clock_hours = "0" + clock_hours;
}
if (clock_minutes < 10)
{
clock_minutes = "0" + clock_minutes;
}
if (clock_seconds < 10)
{
clock_seconds = "0" + clock_seconds;
}
var clock_div = document.getElementById('js_clock');
clock_div.innerHTML = "<strong>" + clock_hours + ":" + clock_minutes + ":" + clock_seconds + " </strong> " + clock_suffix;setTimeout("js_clock()", 1000);
} </pre><br />
<br/><br />
<div style="font-family: Georgia,"Times New Roman",serif;">You can change the time format as your choice. You can see the demo on my blog header.</div><br />
<br/>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-86339498645522837682010-06-25T11:52:00.000-07:002010-06-25T12:11:58.115-07:00LOCK in SQL Server<div><span class="Apple-style-span" style="font-family: Arial; font-size: small;"><span class="Apple-style-span" style="font-size: 13px;"></span></span><br />
<span class="Apple-style-span" style="font-family: Arial; font-size: small;"><span class="Apple-style-span" style="font-size: 13px;"><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><u><span style="color: #548dd4;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">In SQL Server 2000 (Enterprise Manager)<o:p></o:p></span></span></span></u></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">1. Expand server – management-current Activity-expand</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Locks/processid and you will be able to see all the locks related information.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">2. Expand server – management-current Activity-expand Locks/object you can see locks by object information.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><u><span style="color: #548dd4;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">In SQL Server 2005 (SSMS, object Explorer)</span></span></span></u></b><b><u><span style="color: #548dd4;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></u></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Expand-server-management-double click Activity Monitor.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">On left side you have three options to choose from, select those options and you can see all the locks related information.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Run this stored procedure in the database.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">1. </span></span></span><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">sp_lock<o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">To know the running process in the sql server, run this query,<o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">2. </span></span></span><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">select</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">*</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">from</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> sysprocesses</span></span></b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">(in sql server 2000)</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">3. </span></span></span><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">select</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">*</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">from</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: green;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">sys.sysprocesses</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> (in sql server 2005)</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">4. </span></span></span><b><span style="color: maroon;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">sp_who</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">5. </span></span></span><b><span style="color: maroon;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">sp_who2</span></span></span></b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">will also give you some good information.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">To work around the locks, you can run profiler to check which query is creating a lock and if that is necessary.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Types of locks on object level, (general idea)</span></span></span></b><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Database</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">: Database.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Extent</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">: Contiguous group of eight data pages or index pages.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Key</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">: Row lock within an index.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Page</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">: 8-kilobyte (KB) data page or index page.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">RID</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">: Row ID, Used to lock a single row within a table.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Table</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">: Entire table, including all data and indexes.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Types of locks:</span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"><b><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Shared</span></span></span></b><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><b><i><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">(S)</span></span></i></b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> – more than one Query can access the object.</span></span></span><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"><b><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Exclusive lock</span></span><i><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> (X)</span></span></i></span></b><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> – only one Query can access the object.</span></span></span><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"><b><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Update lock </span></span><i><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">(U)</span></span></i></span></b><b><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"><b><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Intent share </span></span><i><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">(IS)</span></span></i></span></b><b><i><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></i></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"><b><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Intent Exclusive </span></span><i><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">(IX)</span></span></i></span></b><b><span style="color: #943634;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Just to give you a brief idea about locks, we have something called as transaction levels in sql server databases.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">TRANSACTION ISOLATION LEVEL<o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"><b><span style="color: #7030a0;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Level 0: READ COMMITTED</span></span></span></b><b><span style="color: #7030a0;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"><b><span style="color: #7030a0;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Level 1: READ UNCOMMITTED</span></span></span></b><b><span style="color: #7030a0;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"><b><span style="color: #7030a0;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Level 2: REPEATABLE READ</span></span></span></b><b><span style="color: #7030a0;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"><b><span style="color: #7030a0;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Level 3: SERIALIZABLE</span></span></span></b><b><span style="color: #7030a0;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Level 0</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> is the lowest level isolation level, if your database is set in this isolation level, no query will lock any resources, under this level, and there will be no locks on the database, not even shared locks.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">SET</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">TRANSACTION</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">ISOLATION</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">LEVEL</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">READ</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">UNCOMMITTED<o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">This data will also read uncommitted data. Data which you have not committed, you can still read that data.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Level1</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> is the default isolation level of the database.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Under this category you will not be able to read uncommitted data; this is also called as dirty data. Under this we will have shared locks.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">As the level increases the locks also increases. The highest is the serializable.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">To make you understand in detail, let’s see an example of what is committed data and what is uncommitted data.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">use</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> pubs<o:p></o:p></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">create</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">table</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> example1 </span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">(</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> eid </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">int</span></span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">,</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> ename </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">varchar</span></span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">(</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">10</span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">))<o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">begin</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">tran</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> T1<o:p></o:p></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">insert</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">into</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> example1 </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">values</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">(</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> 1</span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">,</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> ‘example’</span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">)<o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">go<o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">select</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">*</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">from</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> example1 </span></span></b><b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">— </span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">this is uncommitted data.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">The above is uncommitted transaction, because you started the transaction with a begin, you have to commit the transaction, until then the transaction will not be uncommitted.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">To commit the same transaction</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">commit</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">tran</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> T1<o:p></o:p></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">select</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">*</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">from</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> example1</span></span></b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">— this is committed data.</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">To check the current isolation level of your database, run this command,</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">Dbcc</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">useroptions</span></span></span></b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">— check for isolation level.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">If you don’t want your query to put locks on objects you might want to use something like this,</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><b><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">select</span></span></span></b><b><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">*</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">from</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> example1_1 </span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">with</span></span></span><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> </span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">(</span></span></span><span style="color: blue;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">nolock</span></span></span><span style="color: grey;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">)<o:p></o:p></span></span></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">This will not keep any lock, not even a shared lock on the table. This is the </span></span></span><b><span style="color: red;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">most effective way</span></span></span></b><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"> to avoid locks in SQL.</span></span></span><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><o:p></o:p></span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><span class="Apple-style-span" style="font-size: small;">This is in-depth concept. Hope this will help someone.</span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><br />
</span></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"><span style="color: black;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-family: Verdana, sans-serif;"><a href="http://www.amazon.com/Microsoft-SQL-Server-2005-Unleashed/dp/0672328240?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Microsoft SQL Server 2005 Unleashed" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=0672328240&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=0672328240" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/Expert-SQL-Server-2005-Development/dp/159059729X?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Expert SQL Server 2005 Development" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=159059729X&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=159059729X" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/Microsoft-SQL-Server-2005-Dummies/dp/0764577557?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Microsoft SQL Server 2005 For Dummies" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=0764577557&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=0764577557" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/Master-Lock-178D-Set-Your-Own-Combination/dp/B0009V1WMA?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Master Lock 178D Set-Your-Own Combination Padlock, Die-Cast, Black" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B0009V1WMA&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B0009V1WMA" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><br />
</span></span></span></div><div class="MsoNormal"><br />
</div></span></span></div>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-23480152093496703402010-06-22T08:10:00.000-07:002010-06-22T08:10:31.103-07:00Max Length not working for Multi Line Text Box : SolutionIn almost all the web projects, we require a multiline TextBox control. It was annoying to find that maxLength property doesn't work on multiline textboxes. There is a workaround to accomplish this using RegularExpressionValidator. Following is the markup that will restrict the text box to maximum of 500 characters.<br />
<br />
<br />
<br />
<pre class="brush: xml"><asp:textbox height="100px" id="txtComments" maxlength="10" runat="server" textmode="MultiLine" width="320px"></asp:textbox>
<asp:regularexpressionvalidator controltovalidate="txtComments" errormessage="Maximum 500 characters are allowed in comments box." id="regComments" runat="server" text="Maximum 500 characters are allowed in comments
box." validationexpression="^[\s\S]{0,500}$"> </asp:regularexpressionvalidator>
</pre><br />
<br />
<br />
<br />
OR You it can be done so easily using javascript functions.<br />
<br />
<br />
<br />
I suggest that we should put a javascript validator function so that user will not be able to enter characters more than the length specified, even cant paste any text with more than specified characters. Here are those javascript functions.<br />
<br />
<br />
<br />
TextBox Control<br />
<pre class="brush: xml">
<asp:textbox height="168px" id="txtBox" maxlength="2000" onbeforepaste="doBeforePaste(this);" onkeypress="doKeypress(this);" onpaste="doPaste(this);" runat="server" textmode="MultiLine" width="223px">
</asp:textbox>
</pre><br />
<br />
<br />
<br />
Javascript:<br />
<br />
<br />
<br />
<pre class="brush: jscript ">// Keep user from entering more than maxLength characters
function doKeypress(control){
maxLength = control.attributes["maxLength"].value;
value = control.value;
if(maxLength && value.length > maxLength-1){
event.returnValue = false;
maxLength = parseInt(maxLength);
}
}
</pre><br />
<br />
<br />
<br />
<pre class="brush: jscript ">// Cancel default behavior
function doBeforePaste(control){
maxLength = control.attributes["maxLength"].value;
if(maxLength)
{
event.returnValue = false;
}
}
</pre><br />
<br />
<br />
<br />
<pre class="brush: jscript ">// Cancel default behavior and create a new paste routine
function doPaste(control){
maxLength = control.attributes["maxLength"].value;
value = control.value;
if(maxLength){
event.returnValue = false;
maxLength = parseInt(maxLength);
var oTR = control.document.selection.createRange();
var iInsertLength = maxLength - value.length + oTR.text.length;
var sData = window.clipboardData.getData("Text").substr(0,iInsertLength);
oTR.text = sData;
}
}
</pre><br />
<br />
<br />
One additional thing you have to do is to add maxLength property of text box on Server side Page Load.<br />
<br />
<br />
<br />
<pre class="brush: csharp ">protected void Page_Load(object sender, EventArgs e)
{
txtBox.Attributes.Add("maxLength", txtBox.MaxLength.ToString());
}
</pre><br />
<br />
<br />
Hope this will help you.<br />
<br />
<br />
<a href="http://www.amazon.com/Girl-Who-Played-Fire-ebook/dp/B001NLKT60?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="The Girl Who Played with Fire" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B001NLKT60&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B001NLKT60" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/Girl-Who-Kicked-Hornets-Nest/dp/030726999X?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"></a><a href="http://www.amazon.com/I-Love-The-Way/dp/B003M43ILE?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="I Love The Way" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B003M43ILE&tag=smwo-20" /></a><a href="http://www.amazon.com/s/?ie=UTF8&tag=smwo-20&link_code=btl&camp=213689&creative=392969&search-alias=aps&field-keywords=max%20length" target="_blank"></a><a href="http://www.amazon.com/Pride-Professional-Length-Golf-White/dp/B0026EES6U?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Pride Professional Pro Length Max 4" Golf Tees White" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B0026EES6U&tag=smwo-20" /></a><a href="http://www.amazon.com/Laugh-With-Max-Linder/dp/B000Y960H4?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Laugh With Max Linder" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B000Y960H4&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B000Y960H4" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B0026EES6U" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=btl&camp=213689&creative=392969&o=1&a=" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B003M43ILE" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" />Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com2tag:blogger.com,1999:blog-3469460527526008570.post-21606195328700629732010-06-15T08:39:00.000-07:002010-06-16T11:58:08.204-07:00document.createElement not working on Firefox<span class="Apple-style-span" style="background-color: white;"><span class="Apple-style-span" style="line-height: 17px;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><b><span class="Apple-style-span" style="font-size: x-large;">document.createElement not working on Firefox</span></b></span></span></span><br />
<span class="Apple-style-span" style="background-color: white;"><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"><span class="Apple-style-span" style="line-height: 17px;"><br />
</span></span></span><br />
<span class="Apple-style-span" style="background-color: white;"><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"><span class="Apple-style-span" style="line-height: 17px;"><br />
</span></span></span><br />
<div style="line-height: 17px;"><span class="Apple-style-span" style="background-color: white;"><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;">Javascript method document.createElement() worked perfectly in all browsers other than FireFox. I changed this part</span></span></div><div style="line-height: 17px;"><span class="Apple-style-span" style="background-color: white;"><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;"><br />
</span></span></div><div style="color: white; line-height: 17px;"><span class="Apple-style-span" style="background-color: black;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
</span></span></div><div id="codeSnippetWrapper" style="color: white; line-height: 17px;"><div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 420px;"><pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 420px;"><span id="lnum1" style="color: #606060;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> 1:</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">var</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> newElement = document.createElement(</span><span style="color: #006080;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">"<input name='"</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">+elementName+</span><span style="color: #006080;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">"' id='"</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> + elementName + </span><span style="color: #006080;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">"' type='hidden'>"</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">);</span></pre><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
</span></div><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
<span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif;">to this:</span></span></span></div><span class="Apple-style-span" style="color: white; line-height: 17px;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
</span></span><br />
<div id="codeSnippetWrapper" style="color: white; line-height: 17px;"><div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 420px;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
</span><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 420px;"><span id="lnum1" style="color: #606060;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> 1:</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> </span><span style="color: blue;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">var</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> newElement = document.createElement(</span><span style="color: #006080;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">"input"</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">);</span></pre><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
<br />
</span><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 420px;"><span id="lnum2" style="color: #606060;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> 2:</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> newElement.setAttribute(</span><span style="color: #006080;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">'name'</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">,elementName);</span></pre><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
<br />
</span><br />
<pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 420px;"><span id="lnum3" style="color: #606060;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> 3:</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> newElement.setAttribute(</span><span style="color: #006080;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">'id'</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">,elementName);</span></pre><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
<br />
</span><br />
<pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; line-height: 12pt; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 420px;"><span id="lnum4" style="color: #606060;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> 4:</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"> newElement.setAttribute(</span><span style="color: #006080;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">'type'</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">,</span><span style="color: #006080;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">'hidden'</span></span><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">);</span></pre><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
</span></div><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
</span><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">and now its working with all browsers</span></span></div><div><br />
<br />
<a href="http://www.amazon.com/Firefox-Dummies-Blake-Ross/dp/0471748994?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Firefox For Dummies" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=0471748994&tag=smwo-20" /></a> <img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=0471748994" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/Firefox-Secrets-Need-Know-Guide/dp/0975240242?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Firefox Secrets: A Need-To-Know Guide" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=0975240242&tag=smwo-20" /></a> <img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=0975240242" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/Foxfire-VHS-Hedy-Burress/dp/6304341202?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Foxfire [VHS]" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=6304341202&tag=smwo-20" /></a> <img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=6304341202" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/JavaScript-Beginners-Guide-Osborne-Mcgraw/dp/0071632956?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="JavaScript, A Beginner's Guide, Third Edition (Beginner's Guide (Osborne Mcgraw Hill))" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=0071632956&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=0071632956" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /></div>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-49785171102345192972010-06-02T02:20:00.000-07:002010-06-15T06:24:18.896-07:00Convert a DataTable to HTML<span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">The Following function will return a HTML formatted string for the given dataset.</span><br />
<span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">Some line are commented, you can remove comments if you need.</span><br />
<br />
<b><u>CODE:</u></b><br />
<b><u><br />
</u></b><br />
<br />
<div class="dp-highlighter" style="background-color: #e7e5dc; direction: ltr; font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px; margin-bottom: 18px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 18px !important; overflow-x: auto; overflow-y: auto; padding-top: 1px; text-align: left; width: 478px;"><div class="bar" style="padding-left: 45px;"><div class="tools" style="background-color: #f8f8f8; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; color: silver; direction: ltr; font: normal normal normal 9px/normal Verdana, Geneva, Arial, Helvetica, sans-serif; padding-bottom: 10px; padding-left: 10px; padding-right: 8px; padding-top: 3px; text-align: left;"><br />
</div></div><ol class="dp-c" start="1" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; list-style-image: initial; list-style-position: initial; list-style-type: decimal; margin-bottom: 1px !important; margin-left: 45px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">DataTable dtPriceDetails = SOME DATA TABLE </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">if</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> (dt.Rows.Count > 0) </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">{ </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">string</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> StringDataTable = ConvertToHtmlFile(dtPriceDetails); </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">} </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">public</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">static</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">string</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> ConvertToHtmlFile(DataTable targetTable) </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> { </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">string</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myHtmlFile = </span><span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">""</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">; </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">if</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> (targetTable == </span><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">null</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">) </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> { </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">throw</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">new</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> System.ArgumentNullException(</span><span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">"targetTable"</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">} </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">else</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> { </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//Continue. </span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">} </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//Get a worker object.</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> StringBuilder myBuilder = <span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">new</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> StringBuilder(); </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//Open tags and write the top portion. </span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//myBuilder.Append("<html xmlns='http://www.w3.org/1999/xhtml'>");</html xmlns='http://www.w3.org/1999/xhtml'></span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//myBuilder.Append("");</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//myBuilder.Append("");</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//myBuilder.Append("");</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//myBuilder.Append("");</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">"<table border='1px' cellpadding='5' cellspacing='0' "></table border='1px' cellpadding='5' cellspacing='0' "></span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">"style='border: solid 1px Silver; font-size: x-small;'>"</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//Add the headings row.</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">"<tr align='left' valign='top'>"</tr align='left' valign='top'></span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">foreach</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> (DataColumn myColumn </span><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">in</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> targetTable.Columns) </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> { </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">"<td align='left' valign='top'>"</td align='left' valign='top'></span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(myColumn.ColumnName); </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">""</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> } </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">""</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//Add the data rows. </span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">foreach</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> (DataRow myRow </span><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">in</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> targetTable.Rows) </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> { </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">"<tr align='left' valign='top'>"</tr align='left' valign='top'></span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">foreach</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> (DataColumn myColumn </span><span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">in</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> targetTable.Columns) </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> { </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">"<td align='left' valign='top'>"</td align='left' valign='top'></span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(myRow[myColumn.ColumnName].ToString()); </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">""</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">} </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">""</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">} </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//Close tags. </span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myBuilder.Append(<span class="string" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: blue; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">""</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">); </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//myBuilder.Append(""); </span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//myBuilder.Append("");</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="comment" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #008200; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">//Get the string for return. </span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myHtmlFile = myBuilder.ToString(); </span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> </span></li>
<li class="alt" style="background-color: white; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: inherit; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span class="keyword" style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: #006699; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">return</span><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> myHtmlFile; </span></span></li>
<li class="" style="background-color: #f8f8f8; border-bottom-style: none; border-color: initial; border-left-color: rgb(108, 226, 108); border-left-style: solid; border-left-width: 3px; border-right-style: none; border-top-style: none; border-width: initial; color: #5c5c5c; font-size: 1em; line-height: 14px; list-style-image: initial; list-style-position: outside !important; list-style-type: decimal-leading-zero; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 0px !important; padding-left: 10px !important; padding-right: 3px !important; padding-top: 0px !important;"><span style="background-color: inherit; border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">} </span></li>
</ol><div><embed flashvars="clipboard=DataTable%20dtPriceDetails%20%3D%20SOME%20DATA%20TABLE%20%0A%0Aif%20(dt.Rows.Count%20%3E%200)%0A%7B%0Astring%20StringDataTable%20%3D%20ConvertToHtmlFile(dtPriceDetails)%3B%0A%7D%0A%0A%20%20public%20static%20string%20ConvertToHtmlFile(DataTable%20targetTable)%0A%20%20%7B%0A%20%20%09string%20myHtmlFile%20%3D%20%22%22%3B%0A%0Aif%20(targetTable%20%3D%3D%20null)%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%09throw%20new%20System.ArgumentNullException(%22targetTable%22)%3B%0A%7D%0A%20%20%20%20%20%20else%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%09%2F%2FContinue.%20%0A%7D%0A%0A%2F%2FGet%20a%20worker%20object.%0A%20%20%20%20%20%20StringBuilder%20myBuilder%20%3D%20new%20StringBuilder()%3B%0A%0A%20%20%20%20%20%20%2F%2FOpen%20tags%20and%20write%20the%20top%20portion.%20%0A%20%20%20%20%20%20%2F%2FmyBuilder.Append(%22%3Chtml%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%3E%22)%3B%0A%20%20%20%20%20%20%2F%2FmyBuilder.Append(%22%3Chead%3E%22)%3B%0A%20%20%20%20%20%20%2F%2FmyBuilder.Append(%22%3Ctitle%3E%22)%3B%0A%20%20%20%20%20%20%2F%2FmyBuilder.Append(%22Page-%22)%3B%0A%20%20%20%20%20%20%2F%2FmyBuilder.Append(Guid.NewGuid().ToString())%3B%0A%20%20%20%20%20%20%2F%2FmyBuilder.Append(%22%3C%2Ftitle%3E%22)%3B%0A%20%20%20%20%20%20%2F%2FmyBuilder.Append(%22%3C%2Fhead%3E%22)%3B%0A%20%20%20%20%20%20%2F%2FmyBuilder.Append(%22%3Cbody%3E%22)%3B%0A%20%20%20%20%20%20myBuilder.Append(%22%3Ctable%20border%3D'1px'%20cellpadding%3D'5'%20cellspacing%3D'0'%20%22)%3B%0A%20%20%20%20%20%20myBuilder.Append(%22style%3D'border%3A%20solid%201px%20Silver%3B%20font-size%3A%20x-small%3B'%3E%22)%3B%0A%0A%2F%2FAdd%20the%20headings%20row.%0A%20%20%20%20%20%20myBuilder.Append(%22%3Ctr%20align%3D'left'%20valign%3D'top'%3E%22)%3B%0Aforeach%20(DataColumn%20myColumn%20in%20targetTable.Columns)%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%09myBuilder.Append(%22%3Ctd%20align%3D'left'%20valign%3D'top'%3E%22)%3B%0A%20%20%20%20%20%20myBuilder.Append(myColumn.ColumnName)%3B%0A%20%20%20%20%20%20%09myBuilder.Append(%22%3C%2Ftd%3E%22)%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20myBuilder.Append(%22%3C%2Ftr%3E%22)%3B%0A%0A%2F%2FAdd%20the%20data%20rows.%20%0A%20%20%20%20%20%20foreach%20(DataRow%20myRow%20in%20targetTable.Rows)%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%09myBuilder.Append(%22%3Ctr%20align%3D'left'%20valign%3D'top'%3E%22)%3B%0A%0Aforeach%20(DataColumn%20myColumn%20in%20targetTable.Columns)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%09myBuilder.Append(%22%3Ctd%20align%3D'left'%20valign%3D'top'%3E%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20myBuilder.Append(myRow%5BmyColumn.ColumnName%5D.ToString())%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20myBuilder.Append(%22%3C%2Ftd%3E%22)%3B%0A%7D%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20myBuilder.Append(%22%3C%2Ftr%3E%22)%3B%0A%7D%0A%0A%20%20%20%20%20%20%2F%2FClose%20tags.%20%0A%20%20%20%20%20%20myBuilder.Append(%22%3C%2Ftable%3E%22)%3B%0A%20%20%20%20%20%20%2F%2FmyBuilder.Append(%22%3C%2Fbody%3E%22)%3B%20%0A%20%20%20%20%20%20%2F%2FmyBuilder.Append(%22%3C%2Fhtml%3E%22)%3B%0A%0A%20%20%20%20%20%20%2F%2FGet%20the%20string%20for%20return.%20%0A%20%20%20%20%20%20myHtmlFile%20%3D%20myBuilder.ToString()%3B%0A%0A%20%20%20%20%20%20return%20myHtmlFile%3B%0A%7D%0A" height="0" src="" type="application/x-shockwave-flash" width="0"></embed></div><div><br />
</div></div><br />
<br />
<div class="MsoNormal"><br />
</div><br />
<a href="http://www.amazon.com/HTML-Tags-Chart-ebook/dp/B002HEX88S?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="HTML Tags Chart" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B002HEX88S&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B002HEX88S" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/HTML-Utopia-Designing-Without-Tables/dp/0975240277?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="HTML Utopia: Designing Without Tables Using CSS" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=0975240277&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=0975240277" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/HTML-Essential-Training-William-Weinman/dp/1930727372?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="HTML Essential Training" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=1930727372&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=1930727372" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/Creating-Web-Sites-Missing-Manual/dp/0596008422?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Creating Web Sites: The Missing Manual" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=0596008422&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=0596008422" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><br />
<br />
<div><br />
</div>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-71058525299333827022010-06-01T14:02:00.000-07:002010-06-02T03:22:55.628-07:00Creating a ZIP File using C#.NET<div class="MsoNormal"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;">You can easily create a zip file with C#.NET using Chilkat component.</span></div><div class="MsoNormal"><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"></span></div><span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"></span><br />
<span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"></span><br />
<span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"></span><br />
<span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"></span><br />
<span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"><a name='more'></a></span><br />
<span style="color: blue; font-family: 'Courier New'; font-size: 10pt;">private</span><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">void</span> button1_Click(<span style="color: blue;">object</span> sender, System.EventArgs e)</span><br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;">{<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> Chilkat.Zip zip = <span style="color: blue;">new</span> Chilkat.Zip();<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// Anything begins the 30-day trial<o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">bool</span> unlocked = zip.UnlockComponent(<span style="color: #a31515;">"30-day trial"</span>);<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span> (!unlocked)<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> MessageBox.Show(zip.LastErrorText);<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">return</span>;<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> }<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> zip.NewZip(<span style="color: #a31515;">"test.zip"</span>);<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// Append a directory tree. This simply adds disk file references<o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// to the Zip object. No Zip is created at this point.<o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">bool</span> success = zip.AppendFiles(<span style="color: #a31515;">"tree"</span>, <span style="color: blue;">true</span>);<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span> (!success)<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> MessageBox.Show(zip.LastErrorText);<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">return</span>;<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> }<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// Write test.zip<o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> success = zip.WriteZipAndClose();<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span> (!success)<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> MessageBox.Show(zip.LastErrorText);<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> }<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">else<o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> {<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> MessageBox.Show(<span style="color: #a31515;">"Zip Created!"</span>);<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;"> }<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"><span style="font-family: 'Courier New'; font-size: 10pt;">}</span><br />
<br />
<span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span>To download Chilkat Component, <a href="http://www.chilkatsoft.com/download/ChilkatDotNet2.msi" target="_blank">Click Here</a></div><br />
<a href="http://www.amazon.com/Peltor-H10A-Optime-Over-Earmuff/dp/B00009LI4K?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Peltor H10A Optime 105 Over-the-Head Earmuff" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B00009LI4K&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B00009LI4K" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/National-Geographic/dp/B00005NIOH?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="National Geographic" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B00005NIOH&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B00005NIOH" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/BlackBerry-Bold-9700-Phone-AT/dp/B002XDQHWW?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="BlackBerry Bold 9700 Phone (AT&T)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B002XDQHWW&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B002XDQHWW" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><a href="http://www.amazon.com/OtterBox-Defender-Case-iPhone-Black/dp/B001FVPU9O?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="OtterBox Defender Case for iPhone 3G, 3G S (Black)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B001FVPU9O&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B001FVPU9O" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" /><br />
<a href="http://www.amazon.com/Blackberry-8520-Gemini-Bluetooth-Wi-Fi-International/dp/B002KQLUVU?ie=UTF8&tag=smwo-20&link_code=bil&camp=213689&creative=392969" imageanchor="1" target="_blank"><img alt="Blackberry 8520 Gemini Curve Unlocked Phone with 2 MP Camera, Bluetooth, Wi-Fi--International Version with No Warranty (Black)" src="http://ws.amazon.com/widgets/q?MarketPlace=US&ServiceVersion=20070822&ID=AsinImage&WS=1&Format=_SL160_&ASIN=B002KQLUVU&tag=smwo-20" /></a><img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=smwo-20&l=bil&camp=213689&creative=392969&o=1&a=B002KQLUVU" style="border: none !important; margin: 0px !important; padding: 0px !important;" width="1" />Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-21202185117721242010-06-01T08:36:00.000-07:002010-06-01T08:36:15.786-07:00Installing the FrontPage Server Extensions on IIS 7.0<div style="clear: both; color: #5b5b5b; font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 19px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 30px; padding-top: 20px;">As most people that have installed IIS 7.0 on Windows Vista and Windows Server© 2008 have realized, there are no options to install the FrontPage Server Extensions, leaving only two ways to edit your Web site if it is hosted on a Windows Vista or Windows Server 2008 computer:</div><ul style="color: #5b5b5b; font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; font-size: 13px; list-style-image: initial; list-style-position: initial; list-style-type: disc; margin-bottom: 0px; margin-left: 35px; margin-right: 0px; margin-top: 20px; padding-bottom: 10px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><li style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;">Edit the Web site locally by using the file system.</li>
<li style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;">Use FTP to upload your files to a remote Windows Vista or Windows Server 2008 computer.</li>
</ul><div style="clear: both; color: #5b5b5b; font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 19px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 30px; padding-top: 20px;">Microsoft realizes that the FrontPage Server Extensions are essential to many Web hosting companies and developers, and has worked with Ready-to-Run Software to release a version of the FrontPage 2002 Server Extensions (FPSE 2002) for Windows Vista and Windows Server 2008. This version of FPSE 2002 is available for x86 (32-bit) and x64 (64-bit) Windows Vista and Windows Server 2008 as a separate download for IIS 7.0, and you can download this version by clicking the following URL:</div><div style="clear: both; color: #5b5b5b; font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 19px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 30px; padding-top: 20px;"><br />
</div><div style="clear: both; color: #5b5b5b; font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 19px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 30px; padding-top: 20px;"><span class="Apple-style-span" style="line-height: normal;"><a href="http://go.microsoft.com/fwlink/?LinkId=86544" mce_href="http://go.microsoft.com/fwlink/?LinkId=86544" style="text-decoration: none;" target="_blank"><b><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-style-span" style="color: blue;">FrontPage 2002 Server Extensions for IIS 7.0</span></span></b></a></span><br />
<br />
<br />
<span class="Apple-style-span" style="line-height: normal;"></span><br />
<h3 style="font-family: Tahoma, Verdana, Helvetica, Arial, sans-serif; font-size: 19px; font-weight: normal; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 10px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;">Notes:</h3><ul style="list-style-image: initial; list-style-position: initial; list-style-type: disc; margin-bottom: 0px; margin-left: 35px; margin-right: 0px; margin-top: 20px; padding-bottom: 10px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><li style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;">The FrontPage 2002 Server Extensions (FPSE 2002) are not supported for IIS 7.5 on Windows 7 or Windows Server 2008 R2. If you attempt to install FPSE 2002 on Windows 7 or Windows Server 2008 R2, you should receive several installation errors, following which the server extensions will fail to work.</li>
<li style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;">This release of the FrontPage 2002 Server Extensions (FPSE 2002) is supported Ready-to-Run Software. More information about Ready-to-Run Software is available at the following URL:<ul style="list-style-image: initial; list-style-position: initial; list-style-type: disc; margin-bottom: 0px; margin-left: 35px; margin-right: 0px; margin-top: 20px; padding-bottom: 10px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><li style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"><a href="http://www.rtr.com/fpse/" mce_href="http://www.rtr.com/fpse/" style="color: #118bd8; text-decoration: none;" target="_blank">http://www.rtr.com/fpse/</a></li>
</ul></li>
<li style="clear: both; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px;"><div align="left" style="clear: both; line-height: 19px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 30px; padding-top: 20px;">This version of FPSE 2002 introduces no new functionality; it is essentially the same version of FPSE 2002 that was created for Windows Server 2003, but it has been updated to work on Windows Vista or Windows Server 2008. By way of additional explanation, FPSE 2002 is part of the Office XP system of products. The Office XP system, including FPSE 2002, left mainstream support on July 11th, 2006, according to the <a href="http://support.microsoft.com/?pr=lifecycle" mce_href="http://support.microsoft.com/?pr=lifecycle" style="color: #118bd8; text-decoration: none;" target="_blank">Office lifecycle policy</a>. Because Microsoft's support policy is to remove software from the Download Center that is no longer supported, FPSE 2002 was removed from the Microsoft Download Center at that time as a separate product. FPSE 2002 continues to be available and supported on Windows Server 2003 through the Add Windows Components section of the Add/Remove Programs control panel.</div></li>
</ul></div>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com1tag:blogger.com,1999:blog-3469460527526008570.post-43894978677440351112010-05-27T05:17:00.000-07:002010-05-27T05:17:15.655-07:00Managing State with ASP.NET and C#<span class="Apple-style-span" style="font-family: verdana, Arial, Tahoma; font-size: 12px;">Web Applications are disconnected in nature which means that there is no way for the browser to know who is using the application at present time. In classic Asp programming maintaining state was a headache for the <span class="IL_AD" id="IL_AD2" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 12px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">developers</span>. They had to write alot of code to maintain state. But Asp.net model provides easy state <span class="IL_AD" id="IL_AD4" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 12px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">management</span>. In this article we will see how we can persist state in multiple pages so the user is recognized by the browser.</span><br />
<h4 style="color: blue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 7px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="color: blue;">Preserving State in Web Applications</span></h4><div><span style="color: blue;"><span class="Apple-style-span" style="color: black;"><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">There are number of ways that you can use to preserve <span class="IL_AD" id="IL_AD1" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 13px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">the State</span> of the Web Application. Here are some of the possible ways listed.<br />
<br />
1) Using Cookies<br />
<br />
2) Using Session States<br />
<br />
3) Using Application States<br />
<br />
4) Using HttpContext collection<br />
<br />
5) Using ViewState<br />
<br />
These are only some ways of storing the state of the user as well as the application. In this article we will see few of them in detail.</div><br />
<h4 style="color: blue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 7px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="color: blue;">Using Cookies to maintain the state of the application</span></h4><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">Cookies are created on the server side but saved on the client side. In <span class="IL_AD" id="IL_AD5" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 13px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">the button</span> click event of 'Cookies', write this code:<br />
<br />
HttpCookie cName = new HttpCookie("Name");<br />
cName.Value = txtName.Text;<br />
Response.Cookies.Add(cName);<br />
Response.Redirect("WebForm5.aspx");<br />
<br />
First, we create a cookie named "cName". Since one cookie instance can hold many values, we tell the compiler that this cookie will hold "Name" value. We assign to it the value of the TextBox and finally add it in the Response stream, and sent it to the other page using Response.Redirect method.<br />
<br />
Cookies can also have expiration time which means they can expire at some specified time or you can also set the sliding time which means that will expire is that cookies is not being used.</div><br />
<h4 style="color: blue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 7px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="color: blue;">Using Cookieless Sessions in Asp.net</span></h4><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">For all those users who have configured not to accept cookies they can use cookie less sessions. Here is a simple syntax of using the cookieless sessions.<br />
<br />
sessionState<br />
mode="Off"<br />
stateConnectionString=<br />
"tcpip=127.0.0.1:42424"<br />
sqlConnectionString="data source=(local);<br />
Integrated Security=SSPI"<br />
cookieless="true"<br />
timeout="20"</div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">The only downside of using the cookieless sessions is that you cannot use the absolute urls and must code each link manually.</div><br />
<h4 style="color: blue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 7px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="color: blue;">Using Session Variables to store the state of the application</span></h4><div><span style="color: blue;"><span class="Apple-style-span" style="color: black;"><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">Sessions are created as soon as the <span class="IL_AD" id="IL_AD6" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 13px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">first response</span> is being sent from the client to the server, and session ends when the user closes his browser window or some abnormal operation takes place. Here is how you can use session variables for transferring values. Below you can see a Session is created for the user and "Name" is the key, also known as the Session key, which is assigned the TextBox value.<br />
<br />
// Session Created<br />
Session["Name"] = txtName.Text;<br />
Response.Redirect("WebForm5.aspx");<br />
<br />
// The code below shows how to get the session value.<br />
// This code must be placed in other page.<br />
if(Session["Name"] != null)<br />
Label3.Text = Session["Name"].ToString();</div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">We can also store collections in the Session variables. These collections can be ArrayList or HashTables. Later you can use the casting to retrieve those collections.</div><div><br />
</div><div>For more details, <a href="http://www.exforsys.com/tutorials/asp.net/managing-state-with-asp.net-and-csharp.html" target="_blank">Click Here</a></div></span></span></div></span></span></div>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com1tag:blogger.com,1999:blog-3469460527526008570.post-75575675258667241942010-05-27T05:14:00.000-07:002010-05-27T05:14:06.558-07:00Unable to open physical file - Operating system error 5: 5(error not found) Microsoft SQL Server: Error 5120<span class="Apple-style-span" style="color: #333333; font-family: 'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 16px;"></span><br />
<div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Arial; font-size: x-small; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">I am trying to attach a database to SQL 2005. This database has not previously been attached. I have only just installed SQL.</span></div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><br />
</div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;">I get the following message: Unable to open physical file "C:\ArrowSQL\Arr@Data\Arrow_data.mdf" Operating system error 5: "5(error not found)" (Microsoft SQL Server: Error 5120)".</div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><br />
</div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;">I have loaded SQL and the database fiel and directory with the same user acccount which is a local adminstrator ont hsi machine. I have checked that I have read/write access to the file.</div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><br />
</div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;">The machine runs Windows Vista Business. SQL has SP 2 loaded.</div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"></div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Use the below script to find the sql service account</span></div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><br />
</div><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: blue; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></span></div><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><div class="codeseg" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><div class="codecontent" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><div class="codesniptitle" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; width: 0px;">Code Snippet</span></div><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: blue; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></span><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: blue; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">declare</span></span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> @sqlser <span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: blue; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">varchar</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">(</span>20<span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">)</span></span></div><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: blue; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></span><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: blue; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">EXEC</span></span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> master<span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">..</span>xp_regread @rootkey<span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">=</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">'HKEY_LOCAL_MACHINE'</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">,</span>@key<span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">=</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">'SYSTEM\CurrentControlSet\Services\MSSQLSERVER'</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">,</span></span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></span></div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">@value_name</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">=</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">'objectname'</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">,</span> @value<span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">=</span>@sqlser <span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: blue; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">OUTPUT</span></span></div><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: blue; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></span><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: blue; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">PRINT</span></span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> <span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: red; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">'Account Starting SQL Server Service:' </span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">+</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: magenta; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">convert</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">(</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: blue; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">varchar</span><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">(</span>30<span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">),</span>@sqlser<span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">)</span></span></div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><br />
</div></div></div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><br />
</div></span></span><div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"></div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">After getting the service account try the below steps to provide privilege</span></div><div style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><br />
</div><ul style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 16px; list-style-type: none; margin-bottom: 0px; margin-left: 3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><li style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Right click on the folder C:\ArrowSQL\Arr@Data and click on properties</span></div></li>
<li style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Click on security tab</span></div></li>
<li style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Click on Add button and add sql service account</span></div></li>
<li style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Provide modify privilege and click ok</span></div></li>
<li style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Verify both mdf and ldf have modify privilege</span></div></li>
<li style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Attach the db!</span></div><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><br />
</span></div><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><u><b><i>BEST METHOD.</i></b></u></span></div><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><u><b><i><br />
</i></b></u></span></div><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><u><b><i><br />
</i></b></u></span></div><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Courier; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><u><b><i><span class="Apple-style-span" style="-webkit-text-decorations-in-effect: none; font-style: normal; font-weight: normal;"><div align="left" style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">You can also try the below alternate method to find service account</span></div><div align="left" style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><br />
</div><ul style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 16px; list-style-type: none; margin-bottom: 0px; margin-left: 3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><li style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Goto RUN</span></div></li>
<li style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Type services.msc & press enter</span></div></li>
<li style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">In service control manager find the below service w.r.t to your edition.</span></div></li>
</ul><blockquote dir="ltr" style="background-color: #d0d0d0; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1em; margin-left: 2em; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 1em; padding-left: 1em; padding-right: 1em; padding-top: 1em;"><blockquote dir="ltr" style="background-color: #d0d0d0; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 1em; margin-left: 2em; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 1em; padding-left: 1em; padding-right: 1em; padding-top: 1em;"><div align="left" style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><strong style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">For SQL 2000</strong></span></div><div align="left" style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">MSSQLSERVER -- for default instance</span></div><div align="left" style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">MSSQL$instancename -- for named instance</span></div><div align="left" style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><br />
</div><div align="left" style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><strong style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: bold; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">For SQL 2005 & SQL 2008</strong></span></div><div align="left" style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">SQL Server (MSSQLSERVER) -- for default instance</span></div><div align="left" style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">SQL Server (instancename) -- for named instance</span></div></blockquote></blockquote><ul dir="ltr" style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; line-height: 16px; list-style-type: none; margin-bottom: 0px; margin-left: 3em; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><li style="border-bottom-style: none; border-color: initial; border-color: initial; border-left-style: none; border-right-style: none; border-style: initial; border-top-style: none; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: disc; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><div align="left" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Tahoma; font-style: inherit; font-weight: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">Check the "Log On as" for the SQL service and provide modify privilege to that ID in the folder.</span></div></li>
</ul></span></i></b></u></span></div></li>
</ul><br />
<div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"><br />
</div><div align="left" style="border-bottom-style: none; border-bottom-width: 0px; border-color: initial; border-color: initial; border-left-style: none; border-left-width: 0px; border-right-style: none; border-right-width: 0px; border-style: initial; border-top-style: none; border-top-width: 0px; border-width: initial; font-family: inherit; font-style: inherit; font-weight: inherit; list-style-type: none; margin-bottom: 1em; margin-left: 0px; margin-right: 0px; margin-top: 1em; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;">For More Details, <a href="http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/9e563890-e35f-4524-82b9-3cca08fec5ed/" target="_blank">Click Here</a></div>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com3tag:blogger.com,1999:blog-3469460527526008570.post-42209013851257795562010-05-27T05:05:00.000-07:002010-05-27T05:05:08.585-07:00Creating Web Services with C#<span class="Apple-style-span" style="font-family: verdana, Arial, Tahoma; font-size: 12px;"><strong>Introduction: </strong>We all talk about <span class="IL_AD" id="IL_AD4" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 12px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">webservices</span>, webservices can do this and webservices can do that. But when we are asked to make one, we hesitate. Maybe it's because we never made a webservice before, and all the time playing with Webforms and Windows Forms or even Console Applications. By the way, I love Console applications. In this article, I will show you how to create a simple webservice that is consumed by a Console application client.</span><br />
<span class="Apple-style-span" style="font-family: verdana, Arial, Tahoma; font-size: 12px;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: verdana, Arial, Tahoma; font-size: 12px;"></span><br />
<h4 style="color: blue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 7px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="color: blue;">Motivation of the XML Web Services</span></h4><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">Most of the people does not understand that why we need a <span class="IL_AD" id="IL_AD2" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 13px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">web service</span> and make a wrong use of it. The main idea of a web service is to join two businesses together since they cannot join due to their graphical locations. Web Service is also used to link different systems together. The best thing about this is that the systems can be in different in nature. Meaning a web service enables a <span class="IL_AD" id="IL_AD6" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 13px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">windows application</span> to interact and communicate with the <span class="IL_AD" id="IL_AD5" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 13px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">linux</span> application. This is done by using XML as the transferring medium. Since XML is understood by all the systems because its nothing but plain text that's why this is a perfect language to join systems together. XML web Service should never be used to transfer confidential data, not to be used in real time programming where time is the essence.</div><br />
<h4 style="color: blue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 7px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="color: blue;">Making the Web Service</span></h4><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">First, start your <span class="IL_AD" id="IL_AD1" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 13px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">Visual Studio</span> .NET, and in the project type, select ASP.NET WebService. In the left pane, choose the language of your choice. In this example, I will be using Visual C#.NET. Once you select the project, a page will appear which will be more like a design page, switch to its code view. In the code view, you can see lot of comments and C# code already written for you. You will also see that at the bottom, there is a method<code>HelloWorld</code> which is written for you by default, so you can test your service and of course say hello to the world. After removing the unwanted code and comments, your code will look like this:</div><br />
<div dir="ltr" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;"><em><span style="color: #993300; font-size: x-small;">using System;<br />
using System.Collections;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Diagnostics;<br />
using System.Web;<br />
using System.Web.Services;<br />
<br />
namespace WebServiceExample<br />
{<br />
public class Service1 : System.Web.Services.WebService<br />
{<br />
public Service1()<br />
{<br />
<br />
InitializeComponent();<br />
}<br />
<br />
<br />
// Add the Description Attribute so you<br />
// will know the purpose of your WebService<br />
[WebMethod(Description="This Method prints HelloWorld")]<br />
public string HelloWorld()<br />
{<br />
return "Hello World";<br />
}<br />
}<br />
}</span></em></div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">Let's dig into this small code. <code lang="aspnet">[WebMethod]</code> Attribute denotes that this method will be used by the clients, also this method has to be public in order for a client to use it. Description inside the <code lang="aspnet">WebMethod</code> Attribute just gives the method more meaning. Don't worry about the <code><strong>InitializeComponent()</strong></code> method since it's written by default.</div><br />
<h4 style="color: blue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 7px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="color: blue;">Running the Web Service</span></h4><div><span style="color: blue;"><span class="Apple-style-span" style="color: black;"><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">OK, now you have made your first kick ass WebService (without even writing a single line of code). Let's run it and check whether it gives the correct result or not. In the Solution Explorer, right click on the <em>.asmx</em> file, and select <em>View in Browser</em> as shown below:</div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;"><img height="450" src="http://www.exforsys.com/images/ASP.NET/t10/Image1.jpg" width="557" /></div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">Once you click on "View in Browser", the next screen you will see will be something like this:</div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;"><em><span style="color: #993300;"><img height="143" src="http://www.exforsys.com/images/ASP.NET/t10/Image2.jpg" width="558" /></span></em></div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">have erased most of the stuff, so you can only see the method that you need in this example. Below, you can see the method HelloWorld and the description you wrote for the method.<br />
<br />
Now, click on the HelloWorld method. I don't want to scare you with all the SOAP and HTTP code produced, so I am only going to paste the screen shot which will be relevant to this example.</div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;"><img src="http://www.exforsys.com/images/ASP.NET/t10/Image3.jpg" /></div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">Alright, so far so good. Now, just press the Invoke button to see the result of your method named <code>HelloWorld()</code>.</div><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;"><br />
</div><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;"><span class="Apple-style-span" style="font-size: 12px;"></span></div><h4 style="color: blue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 7px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="color: blue;">Making the Web Service Client</span></h4><div><span style="color: blue;"><span class="Apple-style-span" style="color: black;"><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">Let's make a Console <span class="IL_AD" id="IL_AD3" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 13px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">application</span> which consumes this service. You can use any language and platform to consume this service, that's the purpose of XML WebService. Now, this procedure requires some <span class="IL_AD" id="IL_AD6" style="background-attachment: scroll !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; background-position: 0% 50%; background-repeat: repeat repeat !important; border-bottom-color: rgb(0, 153, 0) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; color: rgb(0, 153, 0) !important; cursor: pointer !important; display: inline !important; font-family: verdana, Arial, Tahoma !important; font-size: 13px !important; font-style: normal !important; font-weight: normal !important; padding-bottom: 1px !important; position: static; text-decoration: underline !important;">mouse clicking</span> :). So I will write down the steps instead of pasting the screen shots.</div><br />
<ol><li style="margin-left: 25px; padding-bottom: 1px; padding-left: 1px; padding-right: 1px; padding-top: 1px; text-align: left;">Start a new project which will be a Console Application in Visual C#.NET.</li>
<li style="margin-left: 25px; padding-bottom: 1px; padding-left: 1px; padding-right: 1px; padding-top: 1px; text-align: left;">Once you see the code view in the Console application, right click on the project name from the Solution Explorer. Remember that project name will be written in bold.</li>
<li style="margin-left: 25px; padding-bottom: 1px; padding-left: 1px; padding-right: 1px; padding-top: 1px; text-align: left;">Click on "Add Web Reference".</li>
<li style="margin-left: 25px; padding-bottom: 1px; padding-left: 1px; padding-right: 1px; padding-top: 1px; text-align: left;">Paste the URL of your WebService. You can get the URL of your WebService when you view your webservice in IE or any other browser.</li>
<li style="margin-left: 25px; padding-bottom: 1px; padding-left: 1px; padding-right: 1px; padding-top: 1px; text-align: left;">Click GO.</li>
<li style="margin-left: 25px; padding-bottom: 1px; padding-left: 1px; padding-right: 1px; padding-top: 1px; text-align: left;">Your webservice will be loaded. In the Web Reference Name textbox, write "MyService" and click Add Reference.</li>
<li style="margin-left: 25px; padding-bottom: 1px; padding-left: 1px; padding-right: 1px; padding-top: 1px; text-align: left;">You will see that the web reference has been added in your Solution Explorer, meaning that webservice is ready to kick some butt.</li>
</ol><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">Now, all you have to do is to make the instance of the WebService class using the reference name that you provided, which is "MyService".</div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;"><span style="color: #993300; font-size: x-small;"><em>using System;<br />
<br />
namespace MyClient<br />
{<br />
class Class1<br />
{<br />
<br />
[STAThread]<br />
static void Main(string[] args)<br />
{<br />
// Make an instance of the WebService Class<br />
// using the Web Reference you provided<br />
MyService.Service1 service = new MyService.Service1();<br />
// Assign message what ever is returned<br />
// from HelloWorld in this case "HelloWorld"<br />
string message = service.HelloWorld();<br />
// Prints out the message on the screen<br />
Console.WriteLine(message);<br />
<br />
}<br />
}<br />
}</em></span></div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">And that's it. You use the webservice class just like any other class. Something you need to keep in mind is that if you decide to make a new method in your webservice and want to make it available to the client, then always remember to build your webservice solution so that the assembly can be updated. If you don't build your webservice, you won't be able to see the methods on the client side.</div><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;"><br />
</div><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;"><span class="Apple-style-span" style="font-size: 12px;"></span></div><h4 style="color: blue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 7px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="color: blue;">Http Clients Creating .NET Consumers</span></h4><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">A consumer is the one who uses the service and a provider is the one who provides the service. Http clients can be an asp.net application or any other application that communicates with the web service through internet.</div><br />
<h4 style="color: blue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 7px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><span style="color: blue;">Web Services and Legacy Clients</span></h4><div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">As I said previously that Web Services are used to communicate between different systems. These systems can be writting different operating systems but their communication medium is xml which they all can understand. These legacy systems can be COBOL, FORTON and PASCAL. So instead of making a complete new application in Asp.net Web Service can be used to link different systems together.</div><div><br />
</div></span></span></div></span><br />
<br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;"><img height="76" src="http://www.exforsys.com/images/ASP.NET/t10/Image4.jpg" style="height: 133px; width: 461px;" width="461" /></div><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: black; font-family: verdana, Arial, Tahoma; font-size: 13px; margin-bottom: 5px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-decoration: none;">This is cool. You have just tested your first webservice and it ran since you didn't coded it. I know what you are thinking right now. Is the client going to see the result like this strange format (this is XML format). Well, of course not. That's why you need to make a Proxy class which consumes this service.</div><div><br />
</div><div><br />
</div><div><a href="http://www.exforsys.com/tutorials/asp.net/creating-and-consuming-xml-web-services-with-csharp.html" target="_blank">Click Here</a> to view details</div></span></div>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-64983513853247407292010-05-27T04:02:00.000-07:002010-05-27T05:08:19.679-07:00Build Your First BlackBerry Application<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; "><img src="http://www.devx.com/assets/dropcaps/3591.gif" />he <a href="http://www.blackberry.com/index.shtml" target="new" style="text-decoration: underline; color: rgb(0, 0, 255); ">BlackBerry</a> wireless handheld device by Research In Motion (RIM) has quickly gained popularity among mobile professionals. With its "Always On, Always Connected" approach, it enables corporate users to connect to their e-mail systems, including Lotus Domino and Microsoft Exchange, and other mission-critical systems (e.g., instant messaging) using a General Packet Radio Service (GPRS)-based wireless connection.<p>BlackBerry supports Java 2 Platform, Micro Edition (J2ME) and ships with a complete Connected Limited Device Configuration/Mobile Information Device Profile (CLDC/MIDP) implementation. Although Blackberry devices run applications that use only the standard MIDP APIs (commonly referred to as MIDlets), developers can also tap into BlackBerry-specific APIs to take advantage features such as sophisticated user interfaces.</p><p>This article introduces the freely available <a href="http://www.blackberry.com/developers/na/java/tools/jde/index.shtml" target="new" style="text-decoration: underline; color: rgb(0, 0, 255); ">BlackBerry Java Development Environment</a> (JDE), which allows you to develop, debug, and test BlackBerry applications. It goes on to demonstrate how to create a simple HelloWorld application that exploits some of BlackBerry's own APIs.</p><p><b>The BlackBerry JDE</b><br />The BlackBerry JDE includes an integrated development environment (IDE) for BlackBerry applications and Blackberry simulation tools that you can use to see exactly how the applications will act on a real BlackBerry device. The BlackBerry JDE also contains a number of working sample applications.</p><p>Before moving on, <a href="http://www.blackberry.com/developers/na/java/start/download.shtml" target="new" style="text-decoration: underline; color: rgb(0, 0, 255); ">download</a> the BlackBerry JDE. At the time of this article's writing, it was in version 4.0.1.</p><p>Installation of the JDE requires that you have the Java 2 Platform, Standard Edition (J2SE) v1.4 running. InstallShield walks you through the JDE installation. When you choose a complete installation type, it should create a Research in Motion program group in your Start menu.</p><p></p><p><br /><br /><br /><b>Prepare to Say Hello</b><br />Start up the Blackberry JDE by going to Start -> All Programs -> Research In Motion -> BlackBerry Java Development Environment 4.0 -> JDE. You should see the RIM development environment. Use the Files tab of the Workspace view to drill down into the com\rim\samples\device folder. There you will see a number of sample application projects that you can dissect to your heart's content. One of them is a HelloWorld application (see <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 1</a>).</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="right" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12726.gif" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 1</a>. Browsing Through the JDE's Samples</td></tr></tbody></table><p>Since life is not very educational if everything is handed to you on a silver platter, this tutorial demonstrates how to build your own HelloWorld application—which actually does exactly what the HelloWorld application that ships as an example does.</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="left" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12727.png" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 2</a>. Creating a New Workspace</td></tr></tbody></table><p>Like many other IDEs, Blackberry projects are collectively housed in units called workspaces. Create a workspace by going to the <b>File</b> menu and choosing the <b>New Workspace…</b> option. Specify a Workspace name of HelloWorldWorkspace as <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 2</a> shows. Here, you can also specify a directory in which to create the workspace. This article uses the default directory locations provided by the IDE.</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="right" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12754.gif" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 3</a>. Creating a New Project in the HelloWorldWorkspace Workspace</td></tr></tbody></table><p>After creating the new workspace, choose the <b>Project</b> menu and then the <b>Create New Project…</b> option. Name the project HelloWorldProject as <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 3</a> shows.</p><p>Next, choose the <b>File</b> menu and the <b>New…</b> option. In the subsequent Create new file window, make sure the Java File type is selected and specify "HelloWorld.java" for the File name, as <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 4</a> shows.</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="left" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12755.gif" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 4</a>. Creating a New File Named HelloWorld.java</td></tr></tbody></table><p>At this point, the IDE creates a barebones Java class with the following code in it:</p><pre><code style="font-size: 12px; "> package ; class HelloWorld { } </code></pre><p>Of course, this code does nothing. It is your job to populate the HelloWorld class with something worthwhile (more on that in a bit). But before that, you need to associate your HelloWorld java file with the HelloWorldProject you created earlier. To do this, simply right click in the code editor area and select the <b>Insert into Project</b> option. From the subsequent project selection window, choose the HelloWorldProject.</p><p></p><p><br /><br /><br /><b>Say HelloWorld</b><br />At this point, you are ready to create your HelloWorld application. Since you want your HelloWorld application to provide a graphical user interface (GUI), you need your HelloWorld class to extend the <code style="font-size: 12px; ">net.rim.device.api.ui.UiApplication</code> class. (<a href="http://www.devx.com/assets/sourcecode/12740.zip" style="text-decoration: underline; color: rgb(0, 0, 255); ">Download</a> the code for the HelloWorld application from the zip file that accompanies this article.)</p><p>Your BlackBerry application starts like a typical J2SE application does, with a <code style="font-size: 12px; ">main</code> method. If you are an experienced MIDlet programmer, you should notice something weird here. A MIDlet starts at the <code style="font-size: 12px; ">startApp()</code> method, but BlackBerry applications start at <code style="font-size: 12px; ">main</code>:</p><pre><code style="font-size: 12px; "> class HelloWorld extends net.rim.device.api.ui.UiApplication { public static void main(String[] args) { HelloWorld instance = new HelloWorld(); instance.enterEventDispatcher(); } public HelloWorld() { pushScreen(new SalutationScreen()); } } </code></pre><p>The first thing you do in the <code style="font-size: 12px; ">main</code> method is create an instance of your application by calling its constructor. The constructor uses the HelloWorld class' parent class (<code style="font-size: 12px; ">UiApplication</code>) method of <code style="font-size: 12px; ">pushScreen</code> to display a screen. You haven't defined the <code style="font-size: 12px; ">SalutationScreen</code> class yet, but rest assured, you'll get to that. After calling the constructor, call your new instance's <code style="font-size: 12px; ">enterEventDispatcher</code> method. This method allows your application to start handling various events that the BlackBerry device may send to the application (e.g., UI-centric events).</p><p>Create a new class in the HelloWorldWorkspace and HelloWorldProject, as you did before, but this time call the new class SalutationScreen.java. The SalutationScreen class is what will actually present a Hello World message to your application user. SalutationScreen.java is shown below:</p><pre><code style="font-size: 12px; "> import net.rim.device.api.ui.*; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.*; class SalutationScreen extends MainScreen { public SalutationScreen() { super(); LabelField applicationTitle = new LabelField("Hello World Title"); setTitle(applicationTitle); RichTextField helloWorldTextField = new RichTextField("Hello World!"); add(helloWorldTextField); } public boolean onClose() { Dialog.alert("Bye World!"); System.exit(0); return true; } } </code></pre><p><b><i>The <code style="font-size: 12px; ">SalutationScreen</code> Class Dissected</i></b><br />The <code style="font-size: 12px; ">SalutationScreen</code> class extends from the <code style="font-size: 12px; ">net.rim.device.api.ui.container.MainScreen</code> class, giving your simple application consistency with other native BlackBerry applications. It also provides such features as a default menu with a Close menu item for exiting out of your application, which the user also can invoke by pressing the BlackBerry Escape key.</p><p>To add a title to your simple application, create a new <code style="font-size: 12px; ">net.rim.device.api.ui.component.LabelField</code> object:</p><pre><code style="font-size: 12px; "> LabelField applicationTitle = new LabelField("Hello World Title"); </code></pre><p>The code above contains a field with the text "Hello World Title". You can always learn more about this API call, as well as other APIs, by taking a look at the API Reference that installed with the JDE. To view the API reference, go to the Help menu and choose the API Reference option or simply press shift+F1 (see <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 5</a>).</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="right" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12747.png" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 5</a>. Using the JDE's API Reference</td></tr></tbody></table><p>After creating your LabelField GUI component, add it to the screen by using the <code style="font-size: 12px; ">add</code> method you inherited from your ancestor class<code style="font-size: 12px; ">net.rim.device.api.ui.Screen</code>.</p><p>You also inherit the onClose method from the net.rim.device.api.ui.Screen, which is fired when your screen (Salutation Screen) closes. In reaction to the closing event, the application uses the alert method of the <code style="font-size: 12px; ">net.rim.device.api.ui.component.Dialog</code> class to display a popup on the screen stating a message of "Bye World!":</p><pre><code style="font-size: 12px; "> public boolean onClose() { Dialog.alert("Bye World!"); System.exit(0); return true; } </code></pre><p></p><p><br /><br /><br /><b>A Real World "HelloWorld"</b><br />At this point, you are ready to see your simple application in action. But before doing so, you need to make sure that your HelloWorldProject has been marked as Active. Doing so tells the BlackBerry simulator which applications it should run. Go to the <b>Project</b> menu and select the <b>Set Active Projects…</b> option. Make sure the HelloWorldProject is checked and click OK.</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="right" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12748.gif" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 6</a>. Build the HelloWorldProject and Launch the Simulator</td></tr></tbody></table><p>Next, go to the <b>Build</b> menu and select the <b>Build All and Run</b> option (see <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 6</a>).</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="left" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12756.gif" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 7</a>. Launch the BlackBerry Simulator</td></tr></tbody></table><p>Now, you should see the BlackBerry Simulator launch as shown in <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 7</a>.</p><p>At this point, you can use the up and down arrow keys to find your HelloWorldProject application amongst the installed applications on the simulator. The up and down arrows simulate the thumb wheel of a real BlackBerry device (see<a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 8</a>).</p><p>To choose the application, you can either press the Enter key on your keyboard or the Enter button on the simulator's keyboard. To see how the BlackBerry simulator closely mimics the real life device, you can alternatively click the thumb wheel of the emulator (as shown in <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 9</a>) to launch the HelloWorld application.</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="right" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12757.gif" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 8</a>. Pick the HelloWorldProject Application</td></tr></tbody></table><p></p><table border="0" cellspacing="0" cellpadding="5" align="left" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12758.gif" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 9</a>. Thumbwheel of the Simulator</td></tr></tbody></table><p>Whichever method you chose to launch the application, your efforts should yield the HelloWorld application on the screen of your emulator (see <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 10</a>).</p><p>To exit out of the application, click the Escape button of your keyboard or the Escape button on the side of the BlackBerry emulator. You should see the Bye World! alert as shown in <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 11</a>.</p><p>Clicking OK should bring you back to the application chooser screen. You can click the File menu and the Exit option to exit out of the simulator.</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="right" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12749.jpg" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 10</a>. The HelloWorld Application Launched</td></tr></tbody></table><p></p><table border="0" cellspacing="0" cellpadding="5" align="left" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12759.jpg" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 11</a>. The Bye World! Alert</td></tr></tbody></table><p><b>Multiple Simulation Environments Included</b><br />By default, the BlackBerry JDE 4.0.1 uses the BlackBerry 7290 device simulator, but it offers a large number of BlackBerry simulation devices. To choose one, select the <b>Edit</b> menu and the <b>Preferences…</b> option. In the subsequent Preferences window, choose the Simulator tab and pick among the list of available device profiles. <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 12</a> shows the selection of the BlackBerry 7100t profile.</p><p>Upon a subsequent run of the simulator, you will be able to run the HelloWorld application on the chosen simulator device (see <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 13</a>).</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="right" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12750.gif" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 12</a>. Choose a Profile for Device Simulation</td></tr></tbody></table><p></p><table border="0" cellspacing="0" cellpadding="5" align="left" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12751.jpg" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 13</a>. Run Your Application on a Simulator</td></tr></tbody></table><p><b>Just Scratching the Surface</b><br />This article demonstrated how to develop Java applications for the BlackBerry device. The BlackBerry JDE provides a powerful environment in which you can develop, debug, test, and simulate applications.</p><p>Like many IDEs, the BlackBerry JDE provides developers with such features as code completion for ease of development. It also lets you look under the hood of your application during the debugging process, allowing you to set breakpoints, step through code line by line, and view variable state information as illustrated in <a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 14</a>.</p><p></p><table border="0" cellspacing="0" cellpadding="5" align="left" width="100"><tbody><tr><td valign="top" style="font-family: Arial, Helvetica, sans-serif; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); "><img border="0" alt="" src="http://www.devx.com/assets/articlefigs/12743.gif" width="100" height="90" /></a></td><td width="12" style="font-family: Arial, Helvetica, sans-serif; "> </td></tr><tr><td class="smallfont" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px; "><a href="http://www.devx.com/wireless/Article/27869/1954" style="text-decoration: underline; color: rgb(0, 0, 255); ">Figure 14</a>. Creation of Breakpoints and Variable Value Inspection</td></tr></tbody></table><p>The simple Hello World application showcased in this article barely scratches the surface of the rich applications you can create for the BlackBerry. Being familiar with the BlackBerry JDE, you should now feel comfortable going through the numerous sample applications the JDE offers.</p><p></p><p></p><div class=""><b>Kulvir Singh Bhogal</b> works as an IBM consultant, devising and implementing Java-centric solutions at customer sites across the nation.</div><div><br /></div></span>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-62408111657715140982010-05-27T03:49:00.000-07:002010-05-27T05:08:19.683-07:00Creating a Windows Service in C#<span class="Apple-style-span" style="font-family: verdana; font-size: small; "><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><strong>NOTE:</strong> The project name in this sample code is <strong>mcWebService</strong>which is a spelling mistake. I meant to put <strong>mcWinService</strong>. And now I don't want to change all the screen shots and code all over again. I hope it won't confuse you :).</span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Ok, its time for one more tutorial. This times pick is Windows Services. Creating Windows Services is not a big deal using C# and<a class="iAs" classname="iAs" href="http://www.c-sharpcorner.com/uploadfile/mahesh/window_service11262005045007am/window_service.aspx#" target="_blank" itxtdid="6666350" style="float: none; left: auto; right: auto; top: auto; bottom: auto; border-top-style: none; border-right-style: none; border-bottom-style: dotted !important; border-left-style: none; border-width: initial; border-color: initial; background-color: transparent !important; line-height: normal; text-align: left; position: static !important; display: inline; font-family: inherit !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px !important; padding-left: 0px; font-weight: normal !important; font-size: 13px; text-decoration: none !important; border-bottom-color: rgb(43, 101, 176) !important; border-bottom-width: 0.2em !important; color: rgb(43, 101, 176) !important; ">Visual <nobr id="itxt_nobr_1_0" style="color: rgb(43, 101, 176); font-weight: normal; font-size: 13px; ">Studio<img src="http://images.intellitxt.com/ast/adTypes/mag-glass_10x10.gif" name="itxt-icon-0" style="display: inline !important; height: 10px; width: 10px; position: relative; top: 1px; left: 1px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; float: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></nobr></a>. Just follow few simple steps and you are all set to run and test your first Windows Service.</span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Windows Services is new name for NT Services you used to develop in previous versions of Visual Studio. This tutorial walks you through how to create and use your Windows Services. This Service writes some text to a text file when stop and start the service. The base idea is taken from MSDN but its more elaborated. You can modify it according to your needs.</span></p><p><strong><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Step 1. Create Skeleton of the Service</span></strong></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">To create a new Window Service, pick Windows Service option from your Visual C# Projects, give your service a name, and click OK.</span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"></span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><img alt="" hspace="0" src="http://www.c-sharpcorner.com/uploadfile/mahesh/window_service11262005045007am/Images/win_service10.jpg" align="baseline" border="0" /></span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">The result look like this. The Wizard adds WebService1.cs class to your project.</span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><img alt="" hspace="0" src="http://www.c-sharpcorner.com/uploadfile/mahesh/window_service11262005045007am/Images/win_service11.jpg" align="baseline" border="0" /></span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Set your <strong>ServiceName</strong> to your own name so it would be easier to recognize your service during testing OR you can set this property programmatically using this line this.ServiceName = "mcWinService";</span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">This is the name you will be looking for later :).</span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><img alt="" hspace="0" src="http://www.c-sharpcorner.com/uploadfile/mahesh/window_service11262005045007am/Images/window12.jpg" align="baseline" border="0" /></span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">The default code of WebService1.cs added by the Wizard looks like here</span></p><span style="font-size:85%;color:#0000ff;"></span><p><span style="font-size:85%;color:#0000ff;"><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">namespace</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> mcWebService<br />{<br /></span><span style="font-size:85%;color:#0000ff;">using</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System;<br /></span><span style="font-size:85%;color:#0000ff;">using</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System.Collections;<br /></span><span style="font-size:85%;color:#0000ff;">using</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System.Core;<br /></span><span style="font-size:85%;color:#0000ff;">using</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System.ComponentModel;<br /></span><span style="font-size:85%;color:#0000ff;">using</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System.Configuration;<br /></span><span style="font-size:85%;color:#0000ff;">using</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System.Data;<br /></span><span style="font-size:85%;color:#0000ff;">using</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System.Web.Services;<br /></span><span style="font-size:85%;color:#0000ff;">using</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System.Diagnostics;<br /></span><span style="font-size:85%;color:#0000ff;">using</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System.ServiceProcess;<br /></span><span style="font-size:85%;color:#0000ff;">public</span><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">class</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> WinService1 : System.ServiceProcess.ServiceBase<br />{<br /></span><span style="font-size:85%;color:#808080;">///</span><span style="font-size:85%;color:#008000;"> </span><span style="font-size:85%;color:#808080;"><summary></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"><br /></span><span style="font-size:85%;color:#808080;">///</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"> Required designer variable.<br /></span><span style="font-size:85%;color:#808080;">///</span><span style="font-size:85%;color:#008000;"> </span><span style="font-size:85%;color:#808080;"></summary></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"><br /></span><span style="font-size:85%;color:#0000ff;">private</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System.ComponentModel.Container components;<br /></span><span style="font-size:85%;color:#0000ff;">public</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> WinService1()<br />{<br /></span><span style="font-size:85%;color:#008000;">// This call is required by the WinForms Component Designer. </span><span style="font-size:85%;">InitializeComponent(); </span></span><span style="font-size:85%;color:#008000;"><br /><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">// TODO: Add any initialization after the InitComponent call<br /></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;">}<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;">// The main entry point for the process<br /></span><span style="font-size:85%;color:#0000ff;">static</span><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">void</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"> Main()<br />{<br />System.ServiceProcess.ServiceBase[] ServicesToRun;<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;color:#008000;">// More than one user Service may run within the same process. To add<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;color:#008000;">// another service to this process, change the following line to<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;color:#008000;">/ create a second service object. For example,<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;color:#008000;">//<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;color:#008000;">// ServicesToRun = New System.ServiceProcess.ServiceBase[] {new WinService1(), new<br />ySecondUserService()};<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;">//<br /></span><span style="font-size:85%;">ServicesToRun = </span><span style="font-size:85%;color:#0000ff;">new</span><span style="font-size:85%;"> System.ServiceProcess.ServiceBase[] { </span><span style="font-size:85%;color:#0000ff;">new</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> WinService1() };<br />System.ServiceProcess.ServiceBase.Run(ServicesToRun);<br />}<br /></span><span style="font-size:85%;color:#808080;">///</span><span style="font-size:85%;color:#008000;"> </span><span style="font-size:85%;color:#808080;"><summary></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"><br /></span><span style="font-size:85%;color:#808080;">///</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"> Required method for Designer support - do not modify<br /></span><span style="font-size:85%;color:#808080;">///</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"> the contents of this method with the code editor.<br /></span><span style="font-size:85%;color:#808080;">///</span><span style="font-size:85%;color:#008000;"> </span><span style="font-size:85%;color:#808080;"></summary></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"><br /></span><span style="font-size:85%;color:#0000ff;">private</span><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">void</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> InitializeComponent()<br />{<br />components = </span><span style="font-size:85%;color:#0000ff;">new</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> System.ComponentModel.Container();<br /></span><span style="font-size:85%;color:#0000ff;">this</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;">.ServiceName = "WinService1";<br />}<br /></span><span style="font-size:85%;color:#808080;">///</span><span style="font-size:85%;color:#008000;"> </span><span style="font-size:85%;color:#808080;"><summary></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"><br /></span><span style="font-size:85%;color:#808080;">///</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"> Set things in motion so your service can do its work.<br /></span><span style="font-size:85%;color:#808080;">///</span><span style="font-size:85%;color:#008000;"> </span><span style="font-size:85%;color:#808080;"></summary></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"><br /></span><span style="font-size:85%;color:#0000ff;">protected</span><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">override</span><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">void</span><span style="font-size:85%;"> OnStart(</span><span style="font-size:85%;color:#0000ff;">string</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;">[] args)<br />{<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;color:#008000;">// TODO: Add code here to start your service.<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;">}<br /></span><span style="font-size:85%;color:#808080;">///</span><span style="font-size:85%;color:#008000;"> </span><span style="font-size:85%;color:#808080;"><summary></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"><br /></span><span style="font-size:85%;color:#808080;">///</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"> Stop this service.<br /></span><span style="font-size:85%;color:#808080;">///</span><span style="font-size:85%;color:#008000;"> </span><span style="font-size:85%;color:#808080;"></summary></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"><br /></span><span style="font-size:85%;color:#0000ff;">protected</span><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">override</span><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">void</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;"> OnStop()<br />{<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;font-size:85%;color:#008000;">// TODO: Add code here to perform any tear-down necessary to stop your service.<br /></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;">}<br />}<br />}<br /></span><br /><strong>Step 2. Add functionality to your service</strong></span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">As you saw WebService1.cs, there are two overridden functions OnStart and OnStop. The OnStart function executes when you start your service and the OnStop function gets execute when you stop a service. I write some text to a text file when you start and stop the service.</span></p><span style="font-size:85%;color:#0000ff;"></span><p><span style="font-size:85%;color:#0000ff;"><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">protected</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">override</span><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">void</span><span style="font-size:85%;"> OnStart(</span><span style="font-size:85%;color:#0000ff;">string</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;">[] args)<br />{<br />FileStream fs = </span><span style="font-size:85%;color:#0000ff;">new</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> FileStream(@"c:\temp\mcWindowsService.txt" ,<br />FileMode.OpenOrCreate, FileAccess.Write);<br />StreamWriter m_streamWriter = </span><span style="font-size:85%;color:#0000ff;">new</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> StreamWriter(fs);<br />m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);<br />m_streamWriter.WriteLine(" mcWindowsService: Service Started \n");<br />m_streamWriter.Flush();<br />m_streamWriter.Close();<br />}<br /></span><span style="font-size:85%;color:#808080;">///</span><span style="font-size:85%;color:#008000;"> </span><span style="font-size:85%;color:#808080;"><summary></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"><br /></span><span style="font-size:85%;color:#808080;">///</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"> Stop this service.<br /></span><span style="font-size:85%;color:#808080;">///</span><span style="font-size:85%;color:#008000;"> </span><span style="font-size:85%;color:#808080;"></summary></span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;color:#008000;"><br /></span><span style="font-size:85%;color:#0000ff;">protected</span><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">override</span><span style="font-size:85%;"> </span><span style="font-size:85%;color:#0000ff;">void</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> OnStop()<br />{<br />FileStream fs = </span><span style="font-size:85%;color:#0000ff;">new</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> FileStream(@"c:\temp\mcWindowsService.txt" ,<br />FileMode.OpenOrCreate, FileAccess.Write);<br />StreamWriter m_streamWriter = </span><span style="font-size:85%;color:#0000ff;">new</span></span><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><span style="font-size:85%;"> StreamWriter(fs);<br />m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);<br />m_streamWriter.WriteLine(" mcWindowsService: Service Stopped \n"); m_streamWriter.Flush();<br />m_streamWriter.Close();<br />}<br /><br /></span><strong>Step 3: Install and Run the Service</strong><br /><br />Build of this application makes one exe, mcWinService.exe. You need to call installutil to<br />egister this service from command line.<br />installutil C:\mcWebService\bin\Debug\mcWebService.exe<br />You use /u option to uninstall the service.<br />installutil /u C:\mcWebService\bin\Debug\mcWebService.exe<br />Run the application</span></p><p><strong><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Step 4: Start and Stop the Service</span></strong></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">You need to go to the <a class="iAs" classname="iAs" href="http://www.c-sharpcorner.com/uploadfile/mahesh/window_service11262005045007am/window_service.aspx#" target="_blank" itxtdid="11065410" style="float: none; left: auto; right: auto; top: auto; bottom: auto; border-top-style: none; border-right-style: none; border-bottom-style: dotted !important; border-left-style: none; border-width: initial; border-color: initial; background-color: transparent !important; line-height: normal; text-align: left; position: static !important; display: inline; font-family: inherit !important; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px !important; padding-left: 0px; font-weight: normal !important; font-size: 13px; text-decoration: none !important; border-bottom-color: rgb(43, 101, 176) !important; border-bottom-width: 0.2em !important; color: rgb(43, 101, 176) !important; "><nobr id="itxt_nobr_27_0" style="color: rgb(43, 101, 176); font-weight: normal; font-size: 13px; ">Computer<img src="http://images.intellitxt.com/ast/adTypes/mag-glass_10x10.gif" name="itxt-icon-0" style="display: inline !important; height: 10px; width: 10px; position: relative; top: 1px; left: 1px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; float: none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; " /></nobr></a> Management to Start to start and stop the service. You can use Manage menu item by right clicking on My Computer. </span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><img alt="" hspace="0" src="http://www.c-sharpcorner.com/uploadfile/mahesh/window_service11262005045007am/Images/window13.gif" align="baseline" border="0" /></span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Under <strong>Services and Applications</strong>, you will see the service <strong>mcWinService</strong>. Start and Stop menu item starts and stops the service.</span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"><img alt="" hspace="0" src="http://www.c-sharpcorner.com/uploadfile/mahesh/window_service11262005045007am/Images/window14.jpg" align="baseline" border="0" /></span></p><p><strong><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Step 5: Test the Service</span></strong></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Go to your temp directory and see if text file is there with contents or not.</span></p><p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">That's it.</span></p></span>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com0tag:blogger.com,1999:blog-3469460527526008570.post-91670419417795862072010-05-16T22:57:00.000-07:002010-05-27T05:08:19.686-07:00Microsoft SQL Server 2005 Service Pack 3 for Windows 7 (64 bit)You can download from here<br /><br /><span style="font-size:130%;">Microsoft SQL Server 2005 Service Pack 3</span><br /><h4>Overview</h4> <div class="downloadInfo"><a name="Description"></a><span>Service Pack 3 for Microsoft SQL Server 2005 is now available. SQL Server 2005 service packs are cumulative, and this service pack upgrades all service levels of SQL Server 2005 to SP3. You can use these packages to upgrade any of the following SQL Server 2005 editions:<br /><ul><li>Enterprise </li><li>Enterprise Evaluation </li><li>Developer </li><li>Standard </li><li>Workgroup </li></ul></span></div><br /><br /><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="quickInfoName">Download Size:<br /></td> <td style="font-weight: bold;" class="quickInfoValue"> 326.0 MB</td></tr></tbody></table><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5D76230D-580D-4874-8C7D-93491A29DB15&displaylang=fr&displaylang=en"><br />http://www.microsoft.com/downloads/details.aspx?FamilyID=ae7387c3-348c-4faa-8ae5-949fdfbe59c4&displaylang=en</a><br /><br /><br /><span style="font-weight: bold;">Microsoft SQL Server Management Studio Express Service Pack 3</span><br /><h4>Overview</h4> <div class="downloadInfo"><a name="Description"></a><span>Microsoft SQL Server Management Studio Express (SSMSE) is a free, easy-to-use graphical management tool for managing SQL Server 2005 Express Edition and SQL Server 2005 Express Edition with Advanced Services. SSMSE can also manage instances of the SQL Server Database Engine created by any edition of SQL Server 2005.<br /><br /><b>Note:</b> SSMSE cannot manage SQL Server Analysis Services, Integration Services, Notification Services, Reporting Services, SQL Server Agent, or SQL Server 2005 Mobile Edition.</span><br /></div><br /><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td class="quickInfoName">Download Size:</td> <td class="quickInfoValue"> <span style="font-weight: bold;">43.3 MB</span></td></tr></tbody></table><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=5D76230D-580D-4874-8C7D-93491A29DB15&displaylang=fr&displaylang=en"><br />http://www.microsoft.com/downloads/details.aspx?FamilyID=5D76230D-580D-4874-8C7D-93491A29DB15&displaylang=fr&displaylang=en</a>Sheikh M. Harishttp://www.blogger.com/profile/01313164758734274281noreply@blogger.com2