Checking The String With Case Sensitivity – SQL

The Following Phrase Is Used For Checking The String With Case Sensitivity:

COLLATE sql_latin1_general_cp1_cs_as

and is used like the following:

Lets Take simple example to understand how it work: CASE SENSITIVE

UserName = admin Password = Admin

  • SELECT * FROM tbUsers WHERE UserName=’Admin’ and Password=’Admin’ COLLATE sql_latin1_general_cp1_cs_as
It should not match and return 0 records.
  • SELECT * FROM tbUsers WHERE UserName=’admin’ and Password=’Admin’ COLLATE sql_latin1_general_cp1_cs_as

It check the string and return you precise result.

The inverse of the above phrase is default and the following which is used the same way: CASE INSENSITIVE

  • SELECT * FROM tbUsers WHERE UserName=’Admin’ and Password=’Admin’  COLLATE sql_latin1_general_cp1_ci_as

 

“Sometimes You Need To Be Faster In Taking Action Than The Decision Is Made.

Because If You Don’t Make A Choice, The Choice Will Make You.”

How to Use WCF Service in Web Application || How to Use WCF Service in Asp.Net for Beginners || WCF Tutorial with Examples for Beginners

Overview

Here I will explain how to use WCF (windows communication foundation) service in web application using c#.net.

Creating simple application using WCF

Here I am going to do WCF sample to insert new record and display user details based on email for that first create table in your database like this

After that First open Visual Studio and click file —> Select New —> Website Under that select WCF Service and give name for WCF Service and click OK

Once you created application you will get default class files including Service.cs and IService.cs

Here IService.cs is an interface it does contain Service contracts and Data Contracts and Service.cs is a normal class inherited by IService where you can define all the methods and other stuff.

Now open IService.cs, check following namespaces and it not in file, add the following namespaces

After that write the following code in IService.cs file

After that open Service.cs class file and add the following namespaces

After that write the following code in Service.cs class file,

Now set the database connection string in web.config file because in above I am getting the connection string from web.config file

Our WCF service ready to use with basicHttpBinding. Now we can call this WCF Service method console applications

After completion of WCF service creations, publish or deploy your WCF Service in your system using F5.

After completion of deploy webservice now we can see how to use WCF Service in our Web application

Calling WCF Service using Web Application

To call WCF service we have many ways like using console app, windows app and web app.
Now I will explain how to use WCF service in web application.

Create new website from visual studio select New—> Website and give some name as you like.

After Creation Website now we need to add WCF reference to our web application for that right click on your web application and select Add Service Reference

Now one wizard will open in that give your WCF service link and click Go after add your service click OK button.

After completion of adding WCF Service first open Default.aspx page and write the following code

Now open Default.aspx.cs file and add following namespaces

After adding namespaces write the following code in codebehind

After completion of adding code check your endpoint connection for WCF Service reference that should be like this

Now everything is ready run your application.

Happy Coding..!! 🙂

Find Created Date and Modified Date – SQL Server

Just a day ago I was working with database. I wanted to know the recently modified date of Store procedure and table. After searching on net I come up with solution. I found simple script to get list of store procedure modified in last 3 days.

Using this script you can retrieve created date and modified date.

SELECT name, modify_date, create_date,

FROM sys.objects

WHERE type = ‘P’

AND DATEDIFF(D,modify_date, GETDATE()) < 3

ORDER BY modify_date DESC

Type: whether it is table, store procedure, etc.

  • S = System Table
  • PK = Primary Key
  • U = User Table
  • P = Stored Procedure
  • TF = Table Value Function
  • FN = Scalar Function
  • D = Default Constraint
  • create_date = Date when it is created
  • modify_date = Last modified date time of table, store procedure, etc.