Thursday, February 4, 2010

Difference between dll and exe

DLL - Dynamic Link Library
  • DLL directly execute. if we want to use dll then we need to add refence in our progrma in Dll there no main function.
  • A DLL use same memory space of client while running.
  • A DLL is much faster.
  • DLL is a dependent type of program. Every DLL has an entry point method and DLL gets loaded only when a call to it is made from any application for the first time.
  • Inprocess - DLL runs along with the application which is sharing that particular DLL. If we interrupt that application that DLL also affected which in turn affects all onter applications which is using that application.
  • error causes off the application.
  • Doesn't have own main entry point, handled by other method(s).

EXE
  • EXE file is excutable file that we can directly run.
  • An exe use own memory space separate from client while running.
  • A exe can be run as standalone program.
  • Have own entry point, handled by OS.
  • outprocess - runs seperately

Monday, August 31, 2009

Enable sqldependency in SQLServer 2008

aspnet_regsql.exe -S server -U user -P password -d database -ed

Thursday, August 20, 2009

how to view saved username in computer.

I was accessing other's pc and he/she has put login aunthentication for security purpose.
So instead of writing again and again username nd password I have save the password.
To view or remove it do the following steps :
1) Go to run.
2) Type rundll32.exe keymgr.dll, KRShowKeyMgr.
You will get the pc name which pc's password you have saved. To remove it click on remove.

Tuesday, August 18, 2009

import excel sheet to database

open sqlserver nd right click on db nd click import data link nd do the further process to import ur excel sheet to database.
ur data will be imported from the excel sheet to database.

Wednesday, August 12, 2009

Procedure to Delete data of database table

Create Procedure dbo.sp_EmptyAllTables (@ResetIdentity Bit)

As

Begin

Declare @SQL VarChar(500)

Declare @TableName VarChar(255)

Declare @ConstraintName VarChar(500)

Declare curAllForeignKeys SCROLL CurSor For Select Table_Name,Constraint_Name From Information_Schema.Table_Constraints Where Constraint_Type='FOREIGN KEY'

Open curAllForeignKeys

Fetch Next From curAllForeignKeys INTO @TableName,@ConstraintName

While @@FETCH_STATUS=0

Begin

Set @SQL = 'ALTER TABLE ' + @TableName + ' NOCHECK CONSTRAINT ' + @ConstraintName

Execute(@SQL)

Fetch Next From curAllForeignKeys INTO @TableName,@ConstraintName

End

Declare curAllTables Cursor For Select Table_Name From Information_Schema.Tables Where TABLE_TYPE='BASE TABLE'

Open curAllTables

Fetch Next From curAllTables INTO @TableName

While @@FETCH_STATUS=0

Begin

Set @SQL = 'DELETE FROM ' + @TableName

If @ResetIdentity = 1 AND OBJECTPROPERTY (OBJECT_ID(@TableName),'TableHasIdentity')=1

Set @SQL = @SQL + '; DBCC CHECKIDENT(''' + @TableName + ''',RESEED,0)'

Execute(@SQL)

Fetch Next From curAllTables INTO @TableName

End

Fetch First From curAllForeignKeys INTO @TableName,@ConstraintName

While @@FETCH_STATUS=0

Begin

Set @SQL = 'ALTER TABLE ' + @TableName + ' CHECK CONSTRAINT ' + @ConstraintName

Execute(@SQL)

Fetch Next From curAllForeignKeys INTO @TableName,@ConstraintName

End

Close curAllTables

Deallocate curAllTables

Close curAllForeignKeys

Deallocate curAllForeignKeys

End

Friday, June 19, 2009

Assembly Error

Error 4 The type 'ASP.aspx_controls_maintop_ascx' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\online_store\7e5e2cc2\6d0e9d9d\App_Web_iv00njwa.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\online_store\7e5e2cc2\6d0e9d9d\App_Web_ndsosjuw.dll' D:\Projects\Online_Store\aspx\Confirm.aspx

If you get error like this that 2 assemblies exists in same path then go to the specified path 
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\
and delete ur project.
Because this is all temporary files and restart ur visual studio.

How to give image url at runtime in any databound controls of asp.net

Take a image tag in ur databound control like gridview,datalist.
If you take asp image tag then set path like bellow
ImageURL = ImageTest(DataBinder.Eval(Container.DataItem, "sLogo") in asp tags.

Here ImageTest is a function in which you can give your imageurl. For example view the following :- 
 protected object ImageTest(object s)
    {
      object path = "~/aspx/productimages/" + Session["Member"] + "\\logo\\" + s;
      return path;
    }

set ur image url in path object variable.

Thank you