Wednesday, November 21, 2012

1. UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.2. UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.3. Inline UDF›s can be though of as views that take parameters and can be used in JOINs and other Rowset operations.

Thursday, November 8, 2012

What is ASPNETDB?
Microsoft has introduced a powerful default database schema in ASP.Net 2.0 as ASPNETDB.mdf database. This database file serves as a role provider, membership provider and web parts personalization handling with the help of BLOBs.

Uses of ASPNETDB database:
ASPNETDB database helps in managing users along with their roles e.g. admin, employee, editors, etc.
It also enables the in-built functionality of Login controls and web parts to be integrated on ASP.Net web pages that helps in managing user profiles, login, and personalized user pages very easily even without writing the bulky code to implement the SQL queries or stored procedures along with data access code for inserting, updating or deleting the user personalized data.

How to use ASPNETDB database?
Fist you need to merge ASPNETDB with your own database. You can merge both databases using tool called "aspnet_regsql".

You can use aspnet_regsql command to create ASPNETDB database. This command executes the default scripts to create the default database for ASP.Net web applications.

Steps to create ASPNETDB database using aspnet_regsql tool:
Open the Visual Studio command prompt from Start -> All Programs -> Microsoft Visual Studio 2005 -> Visual Studio Tools -> Visual Studio 2005 Command Prompt
Type aspnet_regsql and press enter key. This will open the ASP.Net SQL Server Setup Wizard. Click next to continue…
In the next dialog box, select the option "Configure SQL Server for application services". This option executes a script to configure the database for managing user profiles, roles, membership and personalization. Click next to continue…
In this step enter the SQL server name and choose the right authentication method. Leave the database field to default and click next…
Confirm your settings and click next to finish

OR

1. Open the command line by opening the Run dialog box and enter cmd. Then change to the directory C:\Windows\Microsoft.NET\Framework\v2.0.50727
[Note that the last directory’s name may be different, just make sure it’s v2.0, which signifies version 2.0 of the .NET Framework]
2. In this directory run the executable called aspnet_regsql.exe
3. Follow the wizard provide Server Name and the Database Finish it.OR Go Through my post simple way.http://anupshah-wpfandsilverlight.blogspot.in/2012/11/how-to-create-aspnetdb-database.html

To let the solution use the database for user access and profiles, a hidden connection string called LocalSqlServer has to be removed and added again with the new settings. The following code example does that.

1- Create your database in SQL server.2- Open up your ASP.NET website in which you'd like to use ASP.NET membership features.

//Library Usedusing System.Web.Management;//This is the Code which you have to put on a web site which you are working on or any else...put it on page load event.System.Web.Management.SqlServices.Install("YOUR_SERVER", "YOUR_DATABASE", SqlFeatures.All);

Note:

YOUR_SERVER - Means your SQL server name

YOUR_DATABASE- Means your Database in which you want to have this functionality

after execution please go to database and check it the table will be created.