Search This Blog

Saturday, September 21, 2013

Read Connection String From Web.Config VB.Net

VB.NET > Data > SqlConnection > ConnectionString
 
Dim con As SqlConnection
Dim conString As String = System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString").ToString
con = New SqlConnection(conString)
con.Open()




Wednesday, September 18, 2013

Modifier Protected Internal C#

C# > Keywords > internal

Protected Internal variables/methods are accessible within the same assembly and also from the classes that are derived from this parent class.

Example

public class MyClass 
{
    // Only accessible within the same assembly
    internal static string name = "MyClass";
}




ACID SQL

ACID is an acronym for atomicity, consistency, isolation, and durability.

Atomicity
One transaction is atomic. An atomic transaction is either fully completed, or is not begun at all.  If for any reason an error occurs and the transaction is unable to complete all of its steps, the then system is returned to the state it was in before the transaction was started.





Consistency
A transaction enforces consistency in the system state by ensuring that at the end of any transaction the system is in a valid state. If the transaction completes successfully, then all changes to the system will have been properly made, and the system will be in a valid state. If any error occurs in a transaction, then any changes already made will be automatically rolled back.
Isolation
When a transaction runs in isolation, it appears to be the only action that the system is carrying out at one time. If there are two transactions that are both performing the same function and are running at the same time, transaction isolation will ensure that each transaction thinks it has exclusive use of the system.
Durability
A transaction is durable in that once it has been successfully completed, all of the changes it made to the system are permanent. There are safeguards that will prevent the loss of information, even in the case of system failure.

Sunday, September 15, 2013

SQL Server 2012 Services

Services are applications that start without user interaction, normally at computer startup.
Main services in SQL Server 2012:

SQL Server 2012 database engine is responsible for executing commands submitted in the
Transact-SQL, T-SQL, language, database management, memory and disk allocation.

SQL Server Agent is responsible for executing scheduled jobs, monitoring the system and other administrative tasks.

Business intelligence include SQL Server Reporting Services, SQL Server Analysis
Services, and SQL Server Integration Services.





Friday, September 13, 2013

View File Extensions Windows 7

Windows 7 > View File Extensions

By default Windows 7 hides the file extensions of known file types in Explorer views.
To view the file extensions:

Click Start and type folder






Open Folder Option and on View tab and uncheck Hide extensions for known file types



Tuesday, September 10, 2013

Bit Data Type SQL Server

SQL Server > Data Types > Bit

Bit is an integer data type that can take a value of 1, 0, or NULL.
 
Example: Use bit data type to set user is admin or not


CREATE TABLE #Users(
  [Name]  [nvarchar](50) NOT NULL,
  [Admin] [bit] NOT NULL
)

ALTER TABLE [#Users] ADD CONSTRAINT [DF_Users_Admin] DEFAULT ((0)) FOR [Admin]
GO

insert into #Users(Name, Admin) values ('Admin',1), ('John',0)

select * from #Users where Admin = 1
drop table #Users

Result:

Name   Admin
Admin  1






Monday, September 9, 2013

Windows 7 and Windows Server 2008 R2 Service Pack 1

Service Pack 1 for Windows Server 2008 R2 and Windows 7 provides ongoing improvements to the Windows operating system.

Click here to download Windows 7 Service Pack 1