tag:blogger.com,1999:blog-326961422017-09-22T09:28:15.900-05:00ASP.Net, C#, SQL, JQuery, SharepointYou will find discussion topics for ASP.net, C#, JQuery, AJAX, SQL, VB.net, .Net Framework, WCF, WPF, WWF, WSS 3.0, MOSS 2007, OOPs Concepts, SQL Server, Programming.DotNetGutsnoreply@blogger.comBlogger533125http://dailyfreecode.googlepages.com/DFCBanner.gifDotnetGutshttps://feedburner.google.comtag:blogger.com,1999:blog-32696142.post-55962422636536675352017-03-28T05:33:00.002-05:002017-03-28T05:34:15.792-05:00Running Asp.net Core Web Application and Web API project on UbuntuDotNetGutsnoreply@blogger.com0Step 1: Install .Net Core on Ubuntu using this link
Step 2: On Terminal (Cntrl + Alt + T), go to /home/ directory. Create dir. i.e.: mkdir coredemo If you are new to ubuntu: /home/ directory is place where it is good to store user specific stuff.
Step 3: If you are creating
Asp.net Core web application, run command: dotnet web
Asp.net web api, run command: dotnet api
Step 4: dotnet <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=LAM1HZLlUw8:5bkb3AHC4To:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2017/03/running-aspnet-core-web-application-and.htmltag:blogger.com,1999:blog-32696142.post-15736434428251686992017-03-27T20:07:00.002-05:002017-03-28T04:46:15.690-05:00Efficient way of performing filtering, sorting and pagination with MongoDB C#DotNetGutsnoreply@blogger.com0Problem: I run into issue where pagination was bringing almost all the rows from the collection and then doing pagination. In other words it is doing in memory pagination which is inefficient. Recommendation: In order to do MongoDB pagination: avoid using LINQ Query.
Solution:
With following way you can easily and efficiently do filtering, sorting and pagination on mongoDB collection. Below <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=572oqV-G5qk:jN1ZsnUDJqo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2017/03/efficient-way-of-performing-filtering.htmltag:blogger.com,1999:blog-32696142.post-26235795342140524722017-02-28T12:22:00.002-06:002017-02-28T12:22:48.263-06:00Getting SQL Server admin accessDotNetGutsnoreply@blogger.com0Following commands will provide you admin access for SQL Server instance.
Step 1: Run &gt; Services.msc
Step 2: Stop SQL Server (Express)
Step 3: sc start mssql$sqlexpress -m -T3659 -T4010 -T4022
Step 4: sqlcmd -S [SQLInstanceName] -E
Example: sqlcmd -S ComputerName\sqlexpress -E
Step 5:
exec SP_ADDSRVROLEMEMBER 'domainname\username', 'sysadmin'
go
exit
Example:
exec <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=aCs9RAAuOiw:cZSCBnAvU4E:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2017/02/getting-sql-server-admin-access.htmltag:blogger.com,1999:blog-32696142.post-85611762920105658772016-11-26T12:50:00.001-06:002016-11-26T13:19:03.449-06:00Installing .Net Core on Digital Ocean HostingDotNetGutsnoreply@blogger.com0Supporting .Net on Linux OS is the best thing Microsoft gifted to .Net Developers. Linux hosting reduces cost, plus provide good stable support.
This post will walk you through how to get started by installing .Net Core on Digital Ocean Hosting.
I am assuming you already have created DigitalOcean Hosting account and are good to start by creating droplet. Reason I have choose digital ocean is<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=LnWZbC2Rjwg:LP0FZG6PYsE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2016/11/installing-net-core-on-digital-ocean.htmltag:blogger.com,1999:blog-32696142.post-19055288474616106932016-04-04T09:41:00.000-05:002016-12-21T09:36:02.359-06:00Install Mongodb and run as a service to start automatically for windowsDotNetGutsnoreply@blogger.com0
This blog post will explain where to download mongodb, how to install and how to configure to start service automatically.
Step 1: Download mongodb, I am using community edition. Follow step by step installation process to install mongodb.
After installation a directory inside C:\Program Files is created.
Example: In my case: C:\Program Files\MongoDB\Server\[version]
Please note:<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=24EfB-j2Zxg:H2ZcrHQ8llw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2016/04/install-mongodb-and-run-as-service-to.htmltag:blogger.com,1999:blog-32696142.post-63099792631629646032015-06-05T12:44:00.000-05:002015-12-31T10:36:05.872-06:00Example of Inversion of Control and Dependency InjectionDotNetGutsnoreply@blogger.com0
What is an IOC? or What is Inversion of Control?
IOC is mechanism by which we can add abstraction between
dependencies to make them loosely coupled code.
Abstraction is added through interface.
Now lets understand this by example.
Before Implementing IOC:
I have a class called "Black_And_White_Printer" which has one print() method. Print() method will print in black and white. I <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=JH9DUNCMPDo:OqfKnBVgvvg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2015/06/example-of-inversion-of-control-and.htmltag:blogger.com,1999:blog-32696142.post-19105887180947017792015-06-02T18:23:00.003-05:002015-06-02T18:27:22.567-05:00Sql Server Restrict Memory usageDotNetGutsnoreply@blogger.com0With growing of sql server database size and increase in page views of website, you might run in to memory crunch situation.
Please note: You might run into memory crunch situation for number of reasons like memory leak in code, etc, but in this article we will be focusing on only one scenario that is restricting sql server memory usage.
Cause of Memory crunch situation:
By default if you <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=ZtwR_BcEH-M:imjNiyLAm_U:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2015/06/sql-server-restrict-memory-usage.htmltag:blogger.com,1999:blog-32696142.post-65457273067823950522015-05-29T14:23:00.000-05:002015-05-29T14:23:02.914-05:00Securing request pipeline of an ASP.NET MVC 5 ApplicationDotNetGutsnoreply@blogger.com0Good link describing how asp.net mvc request/response pipeline works.
If you are planning to make a custom security layer then this links may interest you.
Asp.net Mvc 5 Life cycle: http://www.asp.net/mvc/overview/getting-started/lifecycle-of-an-aspnet-mvc-5-application
Whtat is OWIN: http://www.asp.net/mvc/overview/getting-started/lifecycle-of-an-aspnet-mvc-5-application
OWIN and Project <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=Uok2aqtiJwc:RBFPUlt9TrQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2015/05/securing-request-pipeline-of-aspnet-mvc.htmltag:blogger.com,1999:blog-32696142.post-13224426834754312672015-04-27T18:31:00.004-05:002015-04-27T18:38:19.406-05:00Create xml file from sql server tableDotNetGutsnoreply@blogger.com0
Following code will create xml file from sql server table.
SQL Server Table
XML Output
&lt;myroot&gt;
&lt;blogs&gt;&gt;/blogs&gt;
&lt;blogid&gt;2601&lt;/blogid&gt;
&lt;title&gt;Program to illustrate operator overloading from string&lt;/title&gt;
&lt;contentvalue&gt;blah blah blah&lt;/contentvalue&gt;
&lt;creationdate&gt;2013-02-18 13:57:00&lt;/creationdate&gt;
....
....
....
....
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=whHrQI22jY0:OWrejinEJJo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2015/04/create-xml-file-from-sql-server-table.htmltag:blogger.com,1999:blog-32696142.post-61079784886580310412014-11-17T11:03:00.000-06:002014-11-18T11:12:07.317-06:00 Could not locate the assembly "System.Web.Mvc,Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,processorArchitecture=MSILDotNetGutsnoreply@blogger.com0Microsoft recent security update has resulted in compilation error. After spending some time came across this link. This is a known issue.
Error: Could not load file or assembly 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=mb9jY5y8zDg:iBQsUuIEE-8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2014/11/could-not-locate-assembly.htmltag:blogger.com,1999:blog-32696142.post-25197286593988060432014-11-16T11:11:00.000-06:002014-11-18T11:11:39.535-06:00Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed.DotNetGutsnoreply@blogger.com0
Error: Attempt by security transparent method 'WebMatrix.WebData.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.WebPageRazorHost.AddGlobalImport(System.String)' failed.
Solution: Install Nuget Package Microsoft.AspNet.WebHelpers
Example: Install-Package Microsoft.AspNet.WebHelpers
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=tN67ztnYwpM:E6CdTiNY5Qs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2014/11/attempt-by-security-transparent-method.htmltag:blogger.com,1999:blog-32696142.post-18049195501341095012014-11-16T11:08:00.000-06:002014-11-18T11:11:51.191-06:00Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)DotNetGutsnoreply@blogger.com0
Error: Could not load file or assembly 'WebMatrix.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Solution: Install Nuget Package Microsoft.AspNet.WebPages.Data
Example: Install-Package Microsoft.AspNet.WebPages.Data
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=icRMRPPcZKM:rv9pjFIchhc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2014/11/could-not-load-file-or-assembly.htmltag:blogger.com,1999:blog-32696142.post-38170228935998879302014-09-08T20:13:00.000-05:002015-12-18T12:42:05.841-06:00Solution: SSD Drive not getting detected on Win 10 OSDotNetGutsnoreply@blogger.com0Recently I have purchase Samsung - 850 EVO 500GB Internal Serial ATA Solid State Drive for Laptops - Black (Model: MZ-75E500B) in order to boost the performance of my laptop.
Issue: SSD Drive was not getting detected on Win 10 OS.
Solution:
This issue was occurring because SSD drive was new and their was no previous partition and disk was not been formatted. Steps to overcome this problem:<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=Q3ZFt1qBaxU:35Ir9MoAaWE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2015/09/solution-ssd-drive-not-getting-detected.htmltag:blogger.com,1999:blog-32696142.post-79427987051371609952014-07-07T16:51:00.000-05:002015-12-18T12:42:20.035-06:00Update Table from Another Table in SQL ServerDotNetGutsnoreply@blogger.com0Update Table from Another Table in SQL Server: A simple scenario demonstrating how we can update Persons table with data from Employees table using update statement. A simple but very effective query which can saves you from creating unnecessary cursor for updating from different tables. By performance wise also Update statement is more efficient compared to creating update cursor.
Update <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=ccjqmmqzM8s:z7tjPHHwYrk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2015/07/update-table-from-another-table-in-sql.htmltag:blogger.com,1999:blog-32696142.post-29579427661240855342014-07-04T17:41:00.000-05:002015-12-18T12:42:40.387-06:00C# Object to Json Object String ExampleDotNetGutsnoreply@blogger.com0Single C# Object to Json Object String Example
Download: https://github.com/dotnetguts/json2csharpAndcsharp2json
Install NewtonSoft.Json Nuget Package
C# Object we will be using in following example
class MemberPics
{
public string PhotoName { get; set; }
public bool IsModerated { get; set; }
}
Json Object String we will be using in following example
@"{'PhotoName':'mypic.jpg','<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=Uz1OJKSBn6I:TakEpqmQoVw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2015/07/c-object-to-json-object-string-example.htmltag:blogger.com,1999:blog-32696142.post-90313656079486024182014-07-04T17:30:00.000-05:002015-12-18T12:42:52.832-06:00Json String to C# Object ExampleDotNetGutsnoreply@blogger.com0Single Json Object String to C# Object Example
Download: https://github.com/dotnetguts/json2csharpAndcsharp2json
Install NewtonSoft.Json Nuget Package
C# Object we will be using in following example
class MemberPics
{
public string PhotoName { get; set; }
public bool IsModerated { get; set; }
}
Json Object String we will be using in following example
@"{'PhotoName':'mypic.jpg','<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=IUfD3EwE-8U:LerLQ_17SDA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2015/07/json-string-to-c-object-example.htmltag:blogger.com,1999:blog-32696142.post-20318657506464514042014-05-24T20:25:00.002-05:002014-05-24T20:30:15.439-05:00A connection was successfully established with the server, but then an error occurred during the login process. (Microsoft SQL Server, Error 233)DotNetGutsnoreply@blogger.com1Error: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (.Net SqlClient Data Provider)
Solution:
Step 1: Open SQL Server Configuration Manager
Go to Windows 8 Start screen.
Start typing in SQLServerManager11.msc if you are looking for SQL <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=7ZB9QzZKHV0:WwUMMsOKXAs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2014/05/a-connection-was-successfully.htmltag:blogger.com,1999:blog-32696142.post-2920322090555165412014-05-24T20:22:00.000-05:002014-05-24T20:22:06.181-05:00Login failed for user. (Microsoft SQL Server, Error 18456)DotNetGutsnoreply@blogger.com0I was recently facing this error when created a SQL Server login and then try login using that newly created login.
Error: Login failed for user. (Microsoft SQL Server, Error 18456) (.Net SqlClient Data Provider)
Please note:
Solution is available on this link, but since microsoft has bad habit of link breaking issue; I have copied and pasted the solution for my reference.
http://<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=9q3GehoVf9c:YbF2vcVsn1Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2014/05/login-failed-for-user-microsoft-sql.htmltag:blogger.com,1999:blog-32696142.post-33342695290949641572014-02-06T04:10:00.003-06:002014-02-06T04:10:52.439-06:00Free ASP.NET Training for 2014DotNetGutsnoreply@blogger.com0Find this useful blog post on Scott hanselman blog
Bookmark for to do list
[01:00] - Windows Azure
[18:17] - Virtual Machines
[41:39] - SQL Database
[49:49] - Web Sites
[1:31:40] - Storage
[1:34:47] - Active Directory
1: What's New in ASP.NET 4.5
2: Building and Deploying Websites with ASP.NET MVC 4
3: Creating HTML5 Applications with jQuery
4: Building a Service Layer with ASP.NET Web API
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=ZDHSiqmpDh0:UfDwuz6QabI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2014/02/free-aspnet-training-for-2014.htmltag:blogger.com,1999:blog-32696142.post-53217630324017698172013-11-12T23:06:00.002-06:002013-11-12T23:06:47.880-06:00Easiest Repository Pattern TutorialDotNetGutsnoreply@blogger.com9I would like to explain how to implement repository pattern before we proceed any further with our single page application discussion.
What is repository pattern?
Repository pattern separates the logic that retrieves the data from the database and logic that uses the data by your application. Thus it makes your data access layer independent of your presentation layer.
As shown in above <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=_UwgtXsd374:1O-HQfI7YBk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2013/11/easiest-repository-pattern-tutorial.htmltag:blogger.com,1999:blog-32696142.post-7907424425889501652013-11-11T22:04:00.002-06:002013-11-11T22:04:26.277-06:00Understanding Flow of control for Hot Towel SPA TemplateDotNetGutsnoreply@blogger.com0Like any other application HTS is not following default route of having Global.asax as starting point. "I believe" this is not good and there are few other things which "I believe" you won't do it for your production code which we will be going to customize in upcoming blog post.
Flow of process for Hot Towel SPA template
App_Start/BreezeWebApiConfig.cs/RegisterBreezePreStart()
App_Start/<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=4Mzyi1fTvGE:WmjaQ8jgPWk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2013/11/understanding-flow-of-control-for-hot.htmltag:blogger.com,1999:blog-32696142.post-20759592895271132952013-11-11T21:38:00.001-06:002013-11-11T21:38:46.992-06:00First Single Page App (SPA) using Hot Towel SPA TemplateDotNetGutsnoreply@blogger.com0In this post, I will be creating our first SPA application using Hot towel SPA template.
If you haven't installed VS.Net 2012.2 Update, then please do it now before reading further.
Step 1: Open VS.Net and start creating asp.net mvc application
Step 2: There are 2 default template available for creating SPA application, choose "Hot Towel SPA" template
Step 3: Ones your solution is ready<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=Ogxs72eEer4:XuvvOs9-SW4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2013/11/first-single-page-app-spa-using-hot.htmltag:blogger.com,1999:blog-32696142.post-3948570343980896822013-11-11T19:37:00.000-06:002013-11-11T19:37:36.557-06:00Single Page Application (SPA) - OverviewDotNetGutsnoreply@blogger.com0For those of you haven't got chance to work on Single Page Application (SPA), I will be discussing few of my learning in series of post, including how to perform CRUD operation using both Breeze and Web Api.
What is Single Page Application (SPA)?
(From Asp.net Site) ASP.NET Single Page Application (SPA) helps you build applications that include significant client-side interactions using HTML 5, <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=GZaE7SiRrwY:gOcXVNegg2s:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2013/11/single-page-application-spa-overview.htmltag:blogger.com,1999:blog-32696142.post-39331077062881195882013-11-09T12:34:00.002-06:002013-11-09T12:34:57.945-06:00NotMapped attribute for PetaPoco or Ignore Column while Insert/Update in PetapocoDotNetGutsnoreply@blogger.com0NotMapped Property for PetaPoco or Ignore Column while Insert/Update in Petapoco
[NotMapped] ==&gt; [ResultColumn]
[NotMapped] equivalent of entity framework in Petapoco is [ResultColumn]
For more information
Example: If you have contact form model where you want user to enter captcha, but you don't want this captcha to be store in db, so In order to ignore captcha column while inserting <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=O_cZoFYHFkE:HDx81tHD5HA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2013/11/notmapped-attribute-for-petapoco-or.htmltag:blogger.com,1999:blog-32696142.post-78857118640847019512013-11-01T13:57:00.000-05:002013-11-01T13:58:15.718-05:00Delete all the rows from all the tables in SQL ServerDotNetGutsnoreply@blogger.com0If you are in situation where you just want empty database structure, without having data in it.
Run following select statement which will generate set of delete statement to delete all the records for all the tables in your database.
SELECT
'Delete from ' + Table_Catalog + '.' + Table_Schema + '.' + Table_Name + ';'
FROM INFORMATION_SCHEMA.TABLES
WHERE Table_Type = 'BASE TABLE'
ORDER by <div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DotnetGuts?a=Q1AwB2MyJRk:bPSie5SsrXw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/DotnetGuts?d=yIl2AUoC8zA" border="0"></img></a>
</div>http://dotnetguts.blogspot.com/2013/11/delete-all-rows-from-all-tables-in-sql.html