1) create below function into database.

-- pass the string 1,2,3
-- delimeter here is ,
Create FUNCTION [dbo].[SplitValue](@Text varchar(Max), @Delimeter varchar(2) = ' ')
RETURNS @ReturnValue TABLE (id int , value varchar(Max))
AS
BEGIN
DECLARE @id int,
    @value varchar(Max),
    @cont bit,
    @strik int,
    @Delimlength int

IF @Delimeter = 'Space'
BEGIN
    SET @Delimeter = ' '
END
--initialize id with 0
SET @id = 0
SET @Text = LTrim(RTrim(@Text))
SET @Delimlength = DATALENGTH(@Delimeter)
SET @cont = 1

IF NOT ((@Delimlength = 0) or (@Delimeter = 'Empty'))
    BEGIN
        WHILE @cont = 1
        BEGIN
        --If you can find the delimiter in the text, retrieve the first element and
        --insert it with its index into the return table.
        IF CHARINDEX(@Delimeter, @Text)>0
            BEGIN
                SET @value = SUBSTRING(@Text,1, CHARINDEX(@Delimeter,@Text)-1)
                BEGIN
                    INSERT @ReturnValue (id, value)
                    VALUES (@id, @value)
                END
                --Increment the index and loop.
                SET @strik = DATALENGTH(@value) + @Delimlength
                SET @id = @id + 1
                SET @Text = LTrim(Right(@Text,DATALENGTH(@Text) - @strik))
            END
        ELSE
        BEGIN
        --If you can’t find the delimiter in the text, @Text is the last value in
        --@ReturnValue.
            SET @value = @Text
            BEGIN
                INSERT @ReturnValue (id, value)
                VALUES (@id, @value)
            END
        --Exit the WHILE loop.
            SET @cont = 0
        END
    END
END
ELSE
BEGIN
    WHILE @cont=1
    BEGIN
    --If the delimiter is an empty string, check for remaining text
    --instead of a delimiter. Insert the first character into the
    --retArray table. Trim the character from the front of the string.
    --Increment the index and loop.
        IF DATALENGTH(@Text)>1
            BEGIN
                SET @value = SUBSTRING(@Text,1,1)
                BEGIN
                INSERT @ReturnValue (id, value)
                VALUES (@id, @value)
                END
                SET @id = @id+1
                SET @Text = SUBSTRING(@Text,2,DATALENGTH(@Text)-1)
            END
        ELSE
            BEGIN
            --One character remains.
            --Insert the character, and exit the WHILE loop.
            INSERT @ReturnValue (id, value)
            VALUES (@id, @Text)
            SET @cont = 0
            END
    END
END
RETURN
END
2) run the following query
select * from dbo.SplitValue('1,2,3',',')
* Here i used reference from othersites.
Thnx.

Create the function which get the total no of child in the parent node.

Steps:

1)      create the table called (tempRecursion)

Fields :

Id int

PId int 

Summary varchar(50) 

Id Pid summary

1   0    a

2   1    b

3   1    c          

4   2    s

     2) now create the function which argument is (id,child count)

FUNCTION [dbo].[fntempRecursion]

(@id int, @getChildInfo int)

bigint

AS

 

BEGIN

 

 

 

 

SET @getChildInfo = @getChildInfo + ( 

 

SELECT Count(id) FROM  tempRecursion WHERE Id =@id )

declare @ref int set @ref =-1 

set @ref =( select pid from tempRecursion where id =@id)

–indicate first node

if(@id <>0 )

( 

SELECT @getChildInfo = dbo.CountChildren(ID, @getChildInfo) FROM

WHERE pid = @id )

END

 

RETURN  @getChildInfo

 

3) run the following query

dbo.fntempRecursion(1,0)

 

Thnx

steps:

1) create simple dotnet application(here i am used C#.net)

2) put the below code

//add namespace
using System.Data.OleDb;
//read Excel File
string FilePath =”c:\test.xls”;
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ FilePath +";Extended Properties=Excel 8.0");
OleDbDataAdapter da = new OleDbDataAdapter("select * from [sheet1$]", con);
DataTable dt = new DataTable();
//get data in datatable
da.Fill(dt);
Thnx
 

steps :

1) create simple application (html).

2) put the below javascript in to the code.

<script language="JavaScript">
      // on right click appear this message
      var DisplayMsg="Right Click Disabled";
      //return message
      function clickBYIE()
      {
          if(document.all)
          {
              alert(DisplayMsg);
              return false;
          }
      }
      //return message
      function clickBYNS(e)
      {
          if (document.layers||(document.getElementById&&!document.all))
          {
              if (e.which==2||e.which==3)
              {
               alert(DisplayMsg);
               return false;
              }
          }
      }

     //set the function as per browser
      if (document.layers)
      {
          document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickBYNS;
      }
      else
      {
          document.onmouseup=clickBYNS;document.oncontextmenu=clickBYIE;
      }
      //disabled the right click on the browser
       document.oncontextmenu=new Function("return false")
  </script>
run the code and check.
thnx

Application variable which remain common for the whole application (your website). Application variable’s value used in whole application. Application state allows you to store global objects that can be accessed by any client. The example of the application variable is site user count.

Session variable which are common for whole application but for particular user. Session is maintain in the page means you can create new session and use to. Example of this when user is login into the site at that time we create one session called user. After the log off we kill this session.

Steps :

1) Open Visual Studio Interface.

2) Open Server Explorer (short cut key for that is ctrl + alt + S or Go to View Menu and Select) .

3)Now Select you database.

3.1) Right Click On Data Connections.

3.2) Select Add Connection. below interface is open. in Interface fill the below information.

1) Server Name

2) Select whether use Windows Authentication or Sql Server Authentication

3) Select Database From Available List or Attach Database

image

4) Select Store Procedures. and Add New Store Procedure in it.

image

5) configure visual studio for debug sql store procedure.

here if you not open any project then open simple project ( i opened asp.net web site).

6) select start up option (Open Menu Web Site –> Start Option). Below Interface Is Open.Tick Sql Server.

image

7) Select Any SP From SP List. and put a break point there.

8 ) right click on the store procedure and Select Step Into Stored Procedure.

image

9) Now SP Debugging Start.

Thanks.

http://amitpatriwala.blogspot.com/

here is the steps:

1) create the simple web application (Asp.net using C#).

Add Name Space using System.IO

2) put the image file in to the application (here i used Sunset.jpg it’s resolution is (800 ,600)).

3) put the one button (id =btnGenerateThumbImage)

4) put the below code in to the click event of the button.

//here is the file name
string ImageFileName = “sunset.jpg”;
//create the image object here and gice the filename
//retrive the physical path of the file
System.Drawing.Image image = System.Drawing.Image.FromFile(Server.MapPath(ImageFileName));

//here is create the object for the newly image
//give the width and height for that image
System.Drawing.Image newImage = image.GetThumbnailImage

(75, 75, new System.Drawing.Image.GetThumbnailImageAbort(Callback), IntPtr.Zero);

// create the object for memory stream
MemoryStream ObjMemoryStream = new MemoryStream();

// save the image in to memory stream and here i used the format jpeg
newImage.Save(ObjMemoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);

// create byte array the same size as the new image
byte[] imageContent = new Byte[ObjMemoryStream.Length];

// asign the position to the memory stream
ObjMemoryStream.Position = 0;
ObjMemoryStream.Read(imageContent, 0, (int)ObjMemoryStream.Length);
Response.ContentType = “image/jpeg”;

Response.BinaryWrite(imageContent);

5) put the below function in to the file which is not important but use it.
/// these is not Required but simple use
        public bool Callback()
        {
            return true;
        }

thnx

http://amitpatriwala.blogspot.com/

When I publish my asp.net application and configure with iis6.0 (in windows XP) I got the error

“The process account used to run ASP.NET must have read access to the IIS metabase “

Steps:

1) Open the command prompt and go to the root path.

2) (here I m used Operating System is Windows XP) go to the dotnet framework Path. cd {Your Root Path}\WINDOWS\Microsoft.NET\Framework\v2.0.50727

3) write this in to command prompt aspnet_regiis –ga ASPNET

run this it gives The User ‘aspnet’ not exist.

This command with parameter (-ga) check the Grants the specified user (ASPNET) or group access to the IIS metabase and other directories that are used by ASP.NET.

4) write this in to command prompt aspnet_regiis –iru

run this it install the iis.

This command is Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and only registers ASP.NET in IIS.

5) write this in to command prompt aspnet_regiis -s W3SVC/1/Root/.

Installs the script map points to the ASP.NET ISAPI version associated with Aspnet_regiis.exe. ASP.NET applications at the specified application root path and its subdirectories.

Thnx.


http://amitpatriwala.blogspot.com/

image

Steps:

1) Create Simple Web Application Using Asp.net (with C#).

2) put the below control on the form. or copy the below code and paste in to application.

Control Id Set Style Of Control
GridView GridView1
Panel other
style="width:100px;" 
Panel pnlGrid
style="overflow:auto;height:200px;width:100px;"
<asp:Panel ID="other" runat="server" style="width:100px;" >
</asp:Panel>
<asp:Panel ID="pnlGrid" runat="server" style="overflow:auto;height:200px;width:100px;" >
  <asp:GridView ID="GridView1" runat="server" >
  </asp:GridView>
</asp:Panel>

3) on the cs file Put the below code.

protected void Page_Load(object sender, EventArgs e)
    {
      //check the page postback
      if (!IsPostBack)
      {
        GridView1.Attributes.Add("style", "table-layout:fixed");
        //here i am use list instead of database
        System.Collections.Generic.List<string> objDataDs = new System.Collections.Generic.List<string>();

        for (int i = 0; i < 100; i++)
        {
          objDataDs.Add(i.ToString());
        }

        GridView1.DataSource = objDataDs;
        GridView1.DataBind();
      }
    }

4) now in the javascript put below code.

 <script language="javascript" type="text/javascript">
function ChangeTheHeaderStyle()
{
//get the clientid of the GridView Where you want to fixed column
var tbl = document.getElementById('<%= GridView1.ClientID%>');
//copy all the row from gridview1
var tblNoOfRow = tbl.cloneNode(true);
//remove all the row from tblNoOfRow
for(var i = tblNoOfRow.rows.length -1;i > 0;i--)
    tblNoOfRow.deleteRow(i);

////delete row 0 (means header from the original)
tbl.deleteRow(0);
////append the remaining row from the tblNoOfRow
other.appendChild(tblNoOfRow);
}
//call the function
window.onload = ChangeTheHeaderStyle

</script>
Check The Application.

Thanks


http://amitpatriwala.blogspot.com/

here i am using simple windows application.

steps:

1) Create Simple Windows Application using VB.net 2.0.

2) put the button (id=button1) on the form.

3) On the Button Click Event put the below code.

Private Sub Button1_Click(ByVal sender As System.Object,
               ByVal e As System.EventArgs) Handles Button1.Click
'get the EnvironmentPath
 MsgBox(" EnvironmentPath " & Environment.CurrentDirectory.ToString())
'get the application path
 Dim str As String = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\"))
 MsgBox(" ApplicationPath " & str)
End Sub

4) output of this Application.

EnvironmentPath : Your Application Path + \bin\Debug

ApplicationPath : Your Application Path + \bin\Debug

here both are same.

5) Create a *Set Up Project and install the set up in to your computer.

EnvironmentPath : Your Drive + Documents and Settings\ + UserFolder

ApplicationPath : Your Drive + Documents and Settings + UserFolder + \Start Menu\Programs

the above path is different.

when you use any file or report path and at that time if you use the EnvironmentPath that will give error.

*Set Up Project :

create set up project using the dotnet i give hint ( Open File Menu : Create New Project

–> Select Other Project Types

–> Set Up And Deployment (select Setup Project).

thanks.