$scope.EmployeeId = $location.search().employeeId ;
C# | MVC | DotnetCore | Web API | Blazor | HTML | BootStrap | JavaScript | JQuery | EF | Angular | SQL | Azure
Tuesday, 28 February 2017
Tuesday, 14 February 2017
serialization and deserialization in C#
Serialization
// Creating emp object
Employee Obj = new Employee ()
{
Name = "Hamid",
Designation= "Software Engineer"
};
// Convert Employee object to JOSN string format
string jsonDataTest = JsonConvert.SerializeObject(Obj);
Response.Write(jsonDataTest);
Deserialization
Employee obj= JsonConvert.DeserializeObject<Employee>(jsonDataTest );
Response.Write(obj.Name);
// Creating emp object
Employee Obj = new Employee ()
{
Name = "Hamid",
Designation= "Software Engineer"
};
// Convert Employee object to JOSN string format
string jsonDataTest = JsonConvert.SerializeObject(Obj);
Response.Write(jsonDataTest);
Deserialization
Employee obj= JsonConvert.DeserializeObject<Employee>(jsonDataTest );
Response.Write(obj.Name);
Monday, 13 February 2017
update multiple row if we have duplicate record in sql
UPDATE T1 SET Col1=Col1+CAST(EmpId AS VARCHAR)
WHERE EmpId NOT IN (
SELECT MIN(EmpId)
FROM T1
GROUP BY Col1
);
WHERE EmpId NOT IN (
SELECT MIN(EmpId)
FROM T1
GROUP BY Col1
);
Tuesday, 7 February 2017
add column if not exist in sql
IF not EXISTS (
SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'Employee') AND name = 'Name'
)
Begin
ALTER TABLE [Employee] ADD Name VARCHAR(200) NULL
end;
SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'Employee') AND name = 'Name'
)
Begin
ALTER TABLE [Employee] ADD Name VARCHAR(200) NULL
end;
Friday, 3 February 2017
convert from string to enum in c#
var abc = (yourEnumName)Enum.Parse(typeof(yourEnumName), yourStringValue);
Subscribe to:
Posts (Atom)