Jagadish's profileJagadish Pulakhandam'sPhotosBlogListsMore ![]() | Help |
|
Fastest path to upgrade to latest .NET technologies
Great links to quickly learn .NET technologies (includes Starter kits, Code samples, Videos etc.)
Blogs I mostly visit
Public folders
|
Jagadish Pulakhandam'sBlogging on .NET, SQL Server and Oracle October 13 TIP: How to fix readonly external hard disks to function in normal mode?Intermittently, your external harddisk may turn to readonly mode. I am talking about the harddisks which do not have any exclusive read-only switch/locks. Even if you restart or plug-in to another computer, the readonly mode may not change.
To make it functioning in write mode as well, just do the following steps:
1. Go to command prompt
2. Type "DISKPART" and hit enter. You will get "DISKPART>" prompt.
3. type "SELECT VOLUME Z" at the "DISKPART" prompt ("Z" being the drive letter of the readonly external hard disk. You need to provide your own drive letter here). The command has to return with "Volumn 4 is the selected volume" (your volume number could be different) followed by DISKPART prompt.
4. type "ATTRIBUTES VOLUME CLEAR READONLY" at the "DISKPART" prompt. This would clear the "READONLY" attribute of the hard disk. It has to return with the message "Volume attributes cleared succesfully".
5. type "EXIT" at the "DISKPART" prompt to get back to normal prompt.
I managed to get the above working (twice) with 1.5TB Western Digital External Disk on Windows Server 2008.
thanks
Jag
February 04 Article: How to bind ComboBox and DataGrid controls in Silverlight 2.0Hai,
My next article on Silverlight 2.0 focusing on "Binding ComboBox and DataGrid controls" got published here http://www.aspfree.com/c/a/BrainDump/Introduction-to-Binding-ComboBox-and-DataGrid-Controls-in-Silverlight-20/
Enjoy..
thanks
Jag January 16 My first day with Windows 7 (beta)Hai Everyone,
Yesterday, I was lucky enough to receive first version of "Windows 7 Beta" installed successfully on my machine. Definitely, it is the most exciting "Windows" release ever. It is almost impossible to cover all of its great features in one single post. Let us see how it looks with default color scheme for the first time:
Let us see the first set of cool things which are eye catching:
More on next post.
thanks
Jag January 15 Article: Designing WCF DataContract Classes Using "LINQ to SQL" DesignerHai,
My new article on "Designing WCF Data Contract Classes using "LINQ to SQL" Designer" got published here.
thanks
Jag December 13 Article: Database operations using Silverlight 2.0, WCF and LINQ to SQLHai,
My next article focusing on development using Silverlight 2.0, WCF and LINQ to SQL got published here http://www.aspfree.com/c/a/Windows-Scripting/Database-operations-using-Silverlight-20-WCF-and-LINQ-to-SQL/
Enjoy......
Jag December 04 Article: LINQ to XML Programming using Visual Basic 2008Hai,
My new article on "LINQ to XML programming using Visual Basic 2008" got published here http://www.aspfree.com/c/a/VB.NET/LINQ-to-XML-Programming-Using-Visual-BasicNET-2008/.
Another article on on "XML DOM programming using Visual Basic 2005" got published here http://www.aspfree.com/c/a/Windows-Scripting/Visual-Basic-2005-XML-Programming-Using-XML-DOM/
thanks
Jag November 21 Article: Two way Binding using Silverlight 2.0, WCF and "LINQ to SQL"Hai,
My new article on "Two way Binding with Silverlight 2.0 controls to WCF" got published here http://www.aspfree.com/c/a/Windows-Scripting/Introducing-Two-Way-Data-Binding-using-Silverlight-20-WCF-and-LINQ-to-SQL/
Thanks,
Jag November 14 Article: Silverlight 2.0 application with "LINQ to SQL" and WCF ServiceHai,
My new article on "Silverlight 2.0 application development with 'LINQ to SQL' and WCF Service" got published here http://www.aspfree.com/c/a/Windows-Scripting/Silverlight-20-Application-Development-with-LINQ-to-SQL-and-a-WCF-Service/
thanks
Jag November 07 Article: Creating a Silverlight 2.0 Application that Consumes a WCF ServiceHai,
My new article on "Silverlight 2.0 accessing WCF Service using Visual Studio 2008" got published here http://www.aspfree.com/c/a/Windows-Scripting/Creating-a-Silverlight-20-Application-that-Consumes-a-WCF-Service/
thanks
Jag October 30 Article: Beginning Silverlight 2.0 development using Visual Studio 2008Hai,
My new article on "Beginning Silverlight 2.0 development using Visual Studio 2008" got published here http://www.aspfree.com/c/a/BrainDump/Beginning-Silverlight-20-Development-using-Visual-Studio-2008/
thanks
Jag October 10 Article: Understanding Delegates using Visual Basic.NET 2005All,
My new article on "Delegates using Visual Basic 2005" got published here http://www.aspfree.com/c/a/VB.NET/Understanding-Delegates-using-Visual-BasicNET-2005/
It explains delegates in a simplest fashion. If you are new to eventing in Visual Basic, make sure that you complete this http://www.aspfree.com/c/a/VB.NET/Understanding-Custom-Events-using-Visual-Basic-NET-2005/ before you go to delegates.
thanks
Jag August 20 Beginning Sharepoint Web part development using Visual Studio 2008Everyone,
My new article on "Sharepoint Web Part development using Visual Studio 2008" got published here:
This will be a great introduction to beginners who would like to learn developing web parts using WSS 3.0 (Windows Sharepoint Services) together with Visual Studio 2008.
It covers the following:
-> creating a new WSS test web site
-> creating a new WSS web part page
-> developing a simple web part using WSS 3.0 and Visual Studio 2008
-> Deploying and viewing the web part
-> Debugging the web part.
Hope you will enjoy reading it.
thanks
Jag July 27 Querying LINQ to SQL: Grouping and AggregatingMy new article got published here http://www.aspfree.com/c/a/.NET/Grouping-and-Aggregating-When-Querying-LINQ-to-SQL/
thanks
Jag July 17 Tip: Generating iCalender file using ASP.NETiCalender is something like an open format text file to add items to the calendar (like Outlook calendar). It is simply a text file which contains fields and information about the particular event of a calendar. Once you double click on the iCalendar file, the respective event gets registered in Outlook calendar (of course, with your approval for the event!).
Following is the ASP.NET code, which generates iCalendar file dynamically (on the fly) and pushes the same to user. The user can either directly open it into Outlook or simply save the iCalendar file.
Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim sb As New StringBuilder(215) sb.AppendFormat("BEGIN:VCALENDAR{0}", Environment.NewLine) sb.AppendFormat("CALSCALE:GREGORIAN{0}", Environment.NewLine) sb.AppendFormat("VERSION:1.0{0}", Environment.NewLine) sb.AppendFormat("BEGIN:VEVENT{0}", Environment.NewLine) sb.AppendFormat("DTSTART:20080703T093000{0}", Environment.NewLine) sb.AppendFormat("DTEND:20080703T113000{0}", Environment.NewLine) sb.AppendFormat("LOCATION:testing some location{0}", Environment.NewLine) sb.AppendFormat("SUMMARY:Testing Some subject{0}", Environment.NewLine) sb.AppendFormat("CLASS:PUBLIC{0}", Environment.NewLine) sb.AppendFormat("END:VEVENT{0}", Environment.NewLine) sb.AppendFormat("END:VCALENDAR{0}", Environment.NewLine)
Dim enc As New UTF8Encoding Dim arrBytData() As Byte = enc.GetBytes(sb.ToString)
Response.Clear() Response.ContentType = "text/plain" Response.AppendHeader("Content-Disposition", "attachment; filename=vCalendar.ics") Response.AppendHeader("Content-Length", arrBytData.Length.ToString()) Response.ContentType = "application/octet-stream" Response.BinaryWrite(arrBytData) Response.Flush() Response.End() End Sub End Class thanks
Jag June 02 Free Book: .NET Developer's guide to Windows SecurityIn depth guide to programming Windows Security using .NET is covered in ".NET Developer's guide to Windows Security". Best of all, it is available FREE to read it on-line.
It is available here http://www.pluralsight.com/wiki/default.aspx/Keith.GuideBook.HomePage
Thanks Keith, for helping .NET developer communities with such a good resource.
Jag May 21 Learning "LINQ to SQL" queries from SELECT statement: basicsHai,
My first article on "Querying LINQ to SQL" got published here
It covers the following (in both VB.NET and C#):
-> fetching rows from a table using LINQ
-> Column aliasing and columns of expressions using LINQ
-> DISTINCT values using LINQ
-> ORDER BY using LINQ
-> Filtering rows
-> dealing with IN, LIKE and IS NULL operators using LINQ
More to be published soon....
thanks
Jag April 07 Working with "LINQ to SQL Designer" using Visual Studio 2008Hello,
My new article on "LINQ to SQL Designer" got published here http://www.aspfree.com/c/a/.NET/Introducing-LINQ-to-SQL-Designer-using-Visual-Studio-2008/
It is very similar to my previous article except that this one focuses on "LINQ to SQL Designer".
thanks
Jag. March 31 Beginning "LINQ to SQL" using Visual Studio 2008Hai,
My new article on "LINQ to SQL" got published here http://www.aspfree.com/c/a/.NET/Beginning-LINQ-to-SQL-Using-Visual-Studio-2008/
It covers all the following topics:
-> Developing a simple "LINQ to SQL" application without using "LINQ to SQL" designer
-> Retrieve and update information using "LINQ to SQL"
-> using DataContext object in LINQ development.
-> Source Code in both Visual Basic and C#
Hope it helps.
thanks
Jag
March 13 TIP: Viewing the generated SQL of LINQ statementsEven though LINQ uses the familar syntax as of SQL, it is not the same SQL generated at run-time. To view the SQL generated from LINQ, we can use "Log" property of "DataContext" in the following manner:
Dim obj As New SampleDAL.SampleDataContext
Dim s As New StringWriter obj.Log = s Me.GridView1.DataSource = From p In obj.emps _ Where p.deptno = 10 _ Select p Me.GridView1.DataBind() Me.Label1.Text = s.ToString You can also make use of VS integrated debugger as shown here
Hope this helps...
thanks,
Jag TIP: Modifying Connection String dynamically for a strongly typed dataset in a different assemblyImagine, I am working on a Visual Studio 2005/2008 solution with class library project (DAL) and Web Application Project (ASP.NET). Say, the DAL is being developed using Dataset Designer with different Strongly Typed DataSets/DataTables together with TableAdapters. Then I would certainly run into a problem.
The DAL (by default) maintains its own connection string in application configuration settings (app.config) and the ASP.NET application maintains its own connection string in Web.config file. Any project, by principle, should not contain connection strings at more than one location.
To make DAL pickup Connection String automatically from web.config by itself (without writing any code) during run-time, simply make sure that the names of connection strings (not the values) are identical in both app.config and web.config.
To make DAL pickup Connection String dynamically from web.config during run-time (at least). It can be easily accomplished by adding the following code to the "MySettings" class in "Setting.Designer.vb" file.
Private Sub MySettings_SettingsLoaded(ByVal sender As Object, ByVal e As System.Configuration.SettingsLoadedEventArgs) Handles Me.SettingsLoaded
Dim s As MySettings = TryCast(sender, MySettings) s.Item("SampleConnectionString") = System.Configuration.ConfigurationManager.ConnectionStrings("cnDev").ConnectionString End Sub To make the above work, you may also need to refer to "System.Configuration" in your class library project.
Hope the above solves the problem...
thanks
Jag
February 26 TIP: Writing a macro in Visual Studio 2005 to attach a process for debugging purposesFor debugging class libraries, web services etc., we may need to attach the debugger to a running ASP.NET process. It is better to write a macro to accomplish the above and use it for any number of times using a simple Key press (with your own key combination). Following are the steps to achieve the same:
Imports System Imports EnvDTE Imports EnvDTE80 Imports System.Diagnostics Imports EnvDTE90 Imports System.IO Public Module AttachProcessToWeb Public Sub AttachProcess() Dim process As EnvDTE.Process For Each process In DTE.Debugger.LocalProcesses If (Path.GetFileName(process.Name).ToLower() = "aspnet_wp.exe") Then process.Attach() Exit Sub End If Next MsgBox("No ASP.NET Development Server found") End Sub End Module
January 29 TIP: Copying DLLs automatically on every successful solution buildHi, During a multi project/solution development, we would always copy DLLs or other executables from source folder to destination folder on every successful build. We can configure our Visual Studio Project in such a way that it copies DLLs (or executables or even other files from any folder) to the destination folders automatically for every successful build. Here is how it can be accomplished (using Project Properties). Any DOS command, Executable tools or even Batch files (.bat) are accepted as part of command line. Hope it helps... thanks Jag January 02 Opening a Popup and refreshing parent (when closed) using ASP.NETThe following is the source code which demonstrates the opening of a popup (from gridview), adding/editing a record in popup and finally refresh the parent window upon closing the popup using ASP.NET:
thanks
Jag December 18 Microsoft Architecture and related Reference Posters.NET Framework 3.5 Common Namespaces and Types
Microsoft® Silverlight™ 1.1 Alpha Developer Reference
Visual C# 2008 Keybinding Reference
Visual Basic 2008 Keybinding Reference
Visual C++ 2008 Keybinding Reference
Visual C++ 2005 Keyboard Shortcut Reference
Visual Basic 2005 Keyboard Shortcut Reference
All Visual Studio 2003 posters
2007 Office System Document: Developer
PnP Overview
Smart Client
Exchange
Active Directory
Windows Server 2008 (Active Directory & Feature Components)
BizTalk Server 2006 Capabilities
BizTalk Server 2006 R2 Capabilities
BizTalk Server 2006 R2 Runtime Architecture
Hope you find those posters quite useful...
thanks
Jag Working efficiently with multiple T-SQL stored procedure parameter valuesSending multiple values in the form of array to a SQL Server stored procedure is very common among database developers. We can send the values in either of the two methods as following:
· Comma separated values (in a single string) · XML document (in a single string)
This post focuses on comma separated values.
The following converts a parameter containing a string (array) of values (separated by commas) to a table:
CREATE FUNCTION dbo.ParmsToList (@Parameters varchar(500)) returns @result TABLE (Value varchar(30)) AS begin DECLARE @TempList table ( Value varchar(30) )
DECLARE @Value varchar(30), @Pos int
SET @Parameters = LTRIM(RTRIM(@Parameters))+ ',' SET @Pos = CHARINDEX(',', @Parameters, 1)
IF REPLACE(@Parameters, ',', '') <> '' BEGIN WHILE @Pos > 0 BEGIN SET @Value = LTRIM(RTRIM(LEFT(@Parameters, @Pos - 1))) IF @Value <> '' BEGIN INSERT INTO @TempList (Value) VALUES (@Value) END SET @Parameters = RIGHT(@Parameters, LEN(@Parameters) - @Pos) SET @Pos = CHARINDEX(',', @Parameters, 1)
END END INSERT @result SELECT value FROM @TempList RETURN END The above function can be tested with the following statement:
select * from dbo.ParmsToList ('1001,2323,jagadish,pulakhandam,3232')
We can utilize the above function and scale out to more functions according to our requirements. For example, I would like to have an “IN” parameter list to be returned for a given string of comma separated values. I can implement a new function (which in-turn invokes the above function) as following:
create function dbo.ParmsToINValues (@Parameters varchar(500)) returns varchar(1000) AS begin DECLARE @item_table TABLE (primary_key INT IDENTITY(1,1) NOT NULL, --THE IDENTITY STATEMENT IS IMPORTANT! item varchar(200) )
insert into @item_table select * from dbo.ParmsToList (@Parameters)
DECLARE @item varchar(200) DECLARE @item_counter INT DECLARE @loop_counter INT DECLARE @result varchar(1000) SELECT @loop_counter = COUNT(*) FROM @item_table SET @item_counter = 1 SET @result = ''
WHILE @loop_counter > 0 AND @item_counter <= @loop_counter BEGIN SELECT @item = item FROM @item_table WHERE primary_key = @item_counter SET @result = @result + '''' + @item + ''',' SET @item_counter = @item_counter + 1 END SET @result = LEFT(@result,LEN(@result)-1) -- trim last comma return @result END
To test the above function, we can use the following script:
declare @result varchar(1000) set @result = dbo.ParmsToINValues('1001,2323,jag,chat,3232') print 'select * from emp where empid in (' + @result + ')'
The resulting output would be as follows:
select * from emp where empid in ('1001','2323','jag','chat','3232')
Hope the post is useful….
Thanks Jag |
List of my published articles
Free Visual Studio 2005/2008 add-ins/plug-ins which boost your productivity
Accelerate .NET development with these FREE controls, components and libraries
Free Controls, Templates, Styles, Source code etc.
Useful .NET tools and other developer tools/utilities
Translators (or converters) for C# and VB.NET
Differences between VB.NET and C#
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|