Archive

Archive for the ‘SQL and .NET Blog’ Category

Silverlight Developer runtime error

July 4, 2010 Leave a comment

Yup, Silverlight developer runtime has to be installed in any development environment for the debugging and execution of the silverlight applications.

You may face errors like "Silverlight Developer Runtime is not installed"

This is due to runtime not available in your local development system.

To install the runtime exe, download this from here: http://go.microsoft.com/fwlink/?LinkID=188039

And try executing the application again and everything will work fine…

Happy coding !!!

-Yuva

http://Yuvahere.com

Advertisements
Categories: SQL and .NET Blog

Optional (or Default) Parameters in C# 4.0

 

This feature of C# has been obtained from VB.NET. In new C# 4.0 there is an option to pass all the parameters as optional and no need to unnecessarily overload the methods. This is really a great feature to be implemented in all the programming languages.

Hands on:

Prior to that we have to include the using of

using System.Runtime.InteropServices

And our functionality as follows

public void MainMethod()
   {
       int parameter1 = 1;
       int parameter2 = 2;
 
 
       MethodCall1(parameter1);
 
       MethodCall2(parameter1,parameter2);     // This method will call MethodCall2 as usual
       MethodCall2(parameter1);                // This method will call MethodCall2 with only 1 parameter and the other is Optional
 
   }
 
  
   public void MethodCall1(int x)
   {
       // this is an example of ordinary method execution
       Console.WriteLine("MethodCall1 is executed");
   }
 
   public void MethodCall2(int x, [Optional] int y)
   {
       // This method will be called with 1 parameter and also with 2 parameters
 
       Console.WriteLine("MethodCall2 is executed");
   }

-Yuva

http://Yuvahere.com

Categories: SQL and .NET Blog

Enterprise Library 3.1 – error while installing – Error code 2869

April 15, 2010 5 comments

Yup, there could be errors like the below image while installing “Enterprise Library May 2007.msi”.

The reason I found for this is, this enterprise library version checks for Visual studio 2005 is installed in the system, though Visual studio 2008 is installed.

I have just installed VS 2008 in my system and thus facing the same error.

Solutions:

1. Install Visual Studio 2005 and then install this “Enterprise Library May 2007.msi”.   –>> Don’t waste time doing this.

2. Download latest Enterprise library like 5.0 or 5.0 beta2 from codeplex  –>> http://entlib.codeplex.com/

The latest version of Enterprise library will install perfectly with out any installation errors.

Happy coding…

-Yuva

http://Yuvahere.com

Categories: SQL and .NET Blog

High growth rate of file groups in SQL Server Database

February 7, 2010 Leave a comment

 

This below query can be used to find all the high growth rate file groups in a SQL server database and

also helps in fine tuning those file groups alone.

USE master
GO
CREATE PROC sp_track_db_growth(@dbnameParam sysname = NULL)
AS
BEGIN
DECLARE @dbname sysname
-- Set the current DB, if dbname is not given input
SET @dbname = COALESCE(@dbnameParam, DB_NAME())
 
SELECT    CONVERT(char, backup_start_date, 111) AS [Date], --yyyy/mm/dd format
    CONVERT(char, backup_start_date, 108) AS [Time],
    @dbname AS [Database Name], [filegroup_name] AS [Filegroup Name], logical_name AS [Logical Filename], 
    physical_name AS [Physical Filename], CONVERT(numeric(9,2),file_size/1048576) AS [File Size (MB)],
    Growth AS [Growth Percentage (%)]
FROM
(
    SELECT    b.backup_start_date, a.backup_set_id, a.file_size, a.logical_name, a.[filegroup_name], a.physical_name,
        (
            SELECT    CONVERT(numeric(5,2),((a.file_size * 100.00)/i1.file_size)-100)
            FROM    msdb.dbo.backupfile i1
            WHERE     i1.backup_set_id = 
                        (
                            SELECT    MAX(i2.backup_set_id) 
                            FROM    msdb.dbo.backupfile i2 JOIN msdb.dbo.backupset i3
                                ON i2.backup_set_id = i3.backup_set_id
                            WHERE    i2.backup_set_id < a.backup_set_id AND 
                                i2.file_type='D' AND
                                i3.database_name = @dbname AND
                                i2.logical_name = a.logical_name AND
                                i2.logical_name = i1.logical_name AND
                                i3.type = 'D'
                        ) AND
                i1.file_type = 'D' 
        ) AS Growth
    FROM    msdb.dbo.backupfile a JOIN msdb.dbo.backupset b 
        ON a.backup_set_id = b.backup_set_id
    WHERE    b.database_name = @dbname AND
        a.file_type = 'D' AND
        b.type = 'D'
        
) as Derived
WHERE (Growth <> 0.0) OR (Growth IS NULL)
ORDER BY [Growth Percentage (%)] desc,logical_name, [Date] desc
END

-Yuva

http://Yuvahere.com

Categories: SQL and .NET Blog

Windows Mobile Device Center – Not Connected ERROR

February 2, 2010 Leave a comment

I faced a problem in Windows mobile device center throwing “Not connected” error marked below.

The solution for this I found is

Goto Start –> Internet Sharing  –> Menu –> Connection settings –>Click USB –>

Set USB Connection setting to “Active Sync” and also check Enable advanced network functionality –> CLick Done –> Done

Now the Windows mobile device center will connect automatically.

-Yuva

http://Yuvahere.com

Categories: SQL and .NET Blog

ASP.NET Object model

January 23, 2010 Leave a comment

Woow, this asp.net object model is a basic and must learn topic for all.

Msdn has posted a article which explains the core concepts and with samples too.

This will definitely be a quick reference for all.

http://msdn.microsoft.com/hi-in/magazine/cc301320(en-us).aspx

————————————————————————————————-

And  now coming to the very basic http object model

The below article will serve the purpose for all.

This article explains the indepth and clear understanding of the pipeline

http://msdn.microsoft.com/en-us/magazine/cc188942.aspx

-Yuva

http://Yuvahere.com

Categories: SQL and .NET Blog

Getting started with Windows Mobile apps and Compact framework

January 17, 2010 Leave a comment

 

First Checking the pre-requisites and creating a basic Hello world application :

1. Check whether your mobile device has “Active Sync” Installed.

2. Now to install “Microsoft .NET Compact framework V3.5” in your mobile device.

Go to the path : “C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE”

and you can c the list of cab files…

I have installed the selected one… Since mine is a Windows mobile and Armv4i – Hence “NETCFv35.wm.armv4i.cab” is the right file for me.

Check this with urs and copy the appropriate cab file to ur device storage card and click to install the “Microsoft .NET Compact framework V3.5” in your mobile device.

3. Create a test Application on compact framework and execute in the mobile device.

Goto ur Visual studio 2008 SDK and File -> New –> Project –>

Now a prompt message appears… Check all as per the colored boxes…

New project will appear in your solution explorer and click on the forms and write ur own application…

 

In the toolbox, drag and drop the label control and set its properties text to “Hello World”.

Now as usual build ur project and a .exe file will be placed in the “\bin\Debug” folder. Copy the .exe file to ur device and click to execute.

njoy

-Yuva

http://Yuvahere.com

Categories: SQL and .NET Blog