Sunday

Jquery Validation: Email Validation using Jquery

Introduction

This is my second post on Jquery Validation, In my previous post, I explained in detail about Numeric Validation using Jquery, now I am going to explain about Email Validation using Jquery.

Input Box to input Email




Jquery Validation: Numeric Validation using Jquery

Introduction

Today, I am going to explain about numeric validation using Jquery. Jquery plays a great role to validate data at client side without refreshing whole the page. To make your application more user friendly, interactive and soothing then Jquery plays a vital role to fulfill your dreams.
Data Input Text Box

Number :  

Saturday

Entity Framework Examples:Entity Framework Code First Examples

Introduction

Entity Framework is an ORM (Object Relational Mapper) which enables to developer cut off code lines. ADO.Net Entity Framework is now every C#/VB apps necessity to use in MVC, ASP.Net, and Windows applications etc. Here is explained operations with code first approach.
Main Operations (CRUD) in Entity Framework is demonstrated below with code snippet.

Pre-Requisites

If you need these snippet into your machine then require following VS 2012/2013, .Net Framework 4.5 and MS SQL Server.

Installing EF NuGet Package

Right click on Reference folder of your respective project to install Entity Framework NuGet Package and select "Manage NuGet Packages"

Installing through Package Manger Console

Alternatively, you can install Entity Framework  through Package Manger Console.
PM> Install-Package EntityFramework

Download Latest Entity Framework

Here is an official link https://www.nuget.org/packages/EntityFramework/ where you can download latest Entity Framework package.

Entity Framework Version History

Here is the complete story of all Entity Framework Versions. Top most in the list are latest versions.

EntityFramework 7.0.0-beta4
EntityFramework 6.1.3 (this version)
EntityFramework 6.1.3-beta1
EntityFramework 6.1.2
EntityFramework 6.1.2-beta2
EntityFramework 6.1.2-beta1
EntityFramework 6.1.1
EntityFramework 6.1.1
EntityFramework 6.1.0
EntityFramework 6.1.0
EntityFramework 6.1.0
EntityFramework 6.0.2
EntityFramework 6.0.2
EntityFramework 6.0.1
EntityFramework 6.0.0
EntityFramework 6.0.0-rc1
EntityFramework 6.0.0-beta1
EntityFramework 6.0.0-alpha3
EntityFramework 6.0.0-alpha2
EntityFramework 6.0.0-alpha1
EntityFramework 5.0.0
EntityFramework 5.0.0-rc
EntityFramework 5.0.0-beta2
EntityFramework 5.0.0-beta1
EntityFramework 4.3.1
EntityFramework 4.3.0
EntityFramework 4.3.0-beta1
EntityFramework 4.2.0
EntityFramework 4.1.10715
EntityFramework 4.1.10331
EntityFramework 4.1.10311

USE EntityFramework connection in ADO.Net Connection

Use Namespace

using System.Data.EntityClient

Use following code snippet to use Entity Framework connection in ADO.Net Connection

string _entityConnString = ConfigurationManager.ConnectionStrings["db_MyDatabase"].ConnectionString;
string _AdoConnString = new EntityConnectionStringBuilder(_entityConnString).ProviderConnectionString;

How to take Maximum Table ID in Database Table using Entity Framework

_context is object of Entity Framework dbContext

Entity Framework dbContext

Delclaring Object of dbContext

Model1 _context = new Model1();
Int32 _TopicIDFK = _context.myTable.Select(x => x.TableID).Max();

How to Delete Records from Database table using Enity Framework

var _item = (from c in _context.mytable.where(x=> x.id = 10) select c).FirstOrDefault();
_context.tblmyTable.Attach(_item);
_context.tblmyTable.Remove(_item);
_context.SaveChanges();

How to Save Records in Database Table using Entity Framework

var _obj = new tblmyTable();
_obj.TableID = 0;
_obj.Name = txtName.Text.Trim();
_context.tblmyTable.Add(_obj);
_context.Entry(_obj).State = EntityState.Added;
_context.SaveChanges();

How to Update/Modify Records in Database Table using Entity Framework

var _obj = new tblmyTable();
_obj = (from c in _context.tblmyTable.Where(x => x.ID == 10) select c).FirstOrDefault();
obj.ID = 10;
_obj.Name = txtName.Text.Trim();

_context.tblmyTable.Add(_obj);
_context.Entry(_obj).State = EntityState.Modified;
_context.SaveChanges();
How to Check Existing Records from database Table using Entity Framework
bool existsOption = _dtOptions.Select().ToList().Exists(row => row["Options"].ToString() == "technology");

How to run ADO.Net SQL Query using Entity Framework

string _sql = "select * from tblmyTable where ID in (" + _ids + ")";
var _img = _context.Set().SqlQuery(_sql);

How to take First Value from Database Table using Entity Framework

_IdQues = _context.tblmyTable.Select(u => u.QuestionIDPK).First();

How to count number of records using Entity Framework

_countQues = _context.tblmyTable.Where(u => u.ClassIDFK == _class && u.SubjectIDFK == 
_subject && u.ChapterIDFK == _chap && u.QuizIDFK == _quiz && u.isRecStatus == true).Count();

Rename Column Name in Database Table using Entity Framework

var query = (from c in _context.tblmyTable.Where(x => x.ID > 5).OrderBy(x => x.CountryIDPK)
select new {Code = c.CountryIDPK, c.CountryName }).ToList();

How to take Distinct Records from database Table using Entity Framework

var result = EFContext.TestAddresses.Select(m => m.Name).Distinct();

How to Pattern Matching using Entity Framework

var _results = from a in mycontainer.users where a.fullname.Contains(mySearchText)
select a.fullname;

Summary

Entity Framework provides developer to code access capability so eliminate code lines. Now every .net framework (c#, Vb.net) developer is primary requirement to use Entity Framework in your application (MVC, ASP.Net, Windows applications). Major operations (CRUD) , count records, Maximum number in table, Column Rename etc of Entity Framework are explained above with coding snippet in great depth.
Suggested Reading

Friday

Entity Framework Error: Validation failed for one or more entities

Introduction

While working on C# app using Entity Framework, I got the issue Validation failed for one or more entities. Today, I have provided a complete solution to over come issue Validation failed for one or more entities while playing with Entity Framework (MS SQL Server database) using C#, MVC, ASP.Net, VN.net etc.

Sunday

SMTP Server: Authentication the Server Response was 5.5.1 Authentication required in gmail

Introduction

I was working on MVC (C#) application sending email through Gmail Server, meanwhile popped up me issue the server response was 5.5.1 authentication required, So we required action to set on security issue which is default off in Gmail Email settings.

Error Description

An exception of type 'System.Net.Mail.SmtpException' occurred in System.dll but was not handled in user code
Additional information: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.

Tuesday

Internet Browser: Internet Explorer replacing with Microsoft Edge in Windows 10

Introduction

Microsoft has introduced replacing Internet Explorer with Microsoft Edge in Windows 10 operating System. Microsoft Edge is fully capable to run seamlessly across multiple devices. Microsoft Edge is little bit lighter to other browsers (Chrome, Firefox, Opera etc.)

Cutting off ActiveX and BHOs

ActiveX are dropping off by new look of Microsoft Edge replacing of old Internet Explorer.
ActiveX contains mainly plugin of Flash, Silver light, Java and PDF plugins. Main reason to dropping off ActiveX is to come off fully of HTML 5 of today brilliant demand to run the content over internet browser across the multiple devices.
Now flash will work alike same as Chrome provides, now Microsoft Edge will provide PDF in native language.

SQL Error: Saving Changes not permitted in SQL Server

Introduction

Today, I am explaining about error saving Changes is not permitted in MS SQL Server, to authorize this permission you have to un-check check box under Tools >> Options menus. If we keep it checked then it will not allow us to change data type during the development so that we require to frequent change or specific requirement then we required it immediately.

Error Description

Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.

Saving Changes not permitted in SQL Server