Translate

Thursday, 6 November 2014

MVC Reference URL

User Registeration with Database:

http://www.mindstick.com/Articles/f769698f-fed6-43eb-8e61-d7baaf713819/

http://dotnetawesome.blogspot.in/2014/03/how-to-create-user-registration-page-in-mvc4.html

http://www.c-sharpcorner.com/UploadFile/raj1979/how-to-make-custom-login-register-and-logout-in-mvc-4-usin/

http://www.c-sharpcorner.com/uploadfile/b19d5a/custom-user-login-and-registration-page-in-Asp-Net-mvc3-with-razor-and-entity-framework/

http://geekswithblogs.net/dotNETvinz/archive/2011/06/03/asp.net-mvc-3-creating-a-simple-sign-up-form.aspx

http://www.techiesweb.net/


Scaffolding:

http://sampathloku.blogspot.in/2014/04/scaffolding-with-aspnet-mvc-5.html

https://www.asp.net/mvc/overview/getting-started/introduction/accessing-your-models-data-from-a-controller

https://visualstudiogallery.msdn.microsoft.com/811973ed-e6a9-4f38-b375-2fee9931bebd


What’s New in ASP.NET MVC 5 that make your MVC web 



ASP.NET MVC3 Vs MVC4 Vs MVC5





Tuesday, 4 November 2014

Arithmetic overflow error converting numeric to data type numeric

SELECT CAST(1234567891234567.34 AS NUMERIC(18,2))  --Works
SELECT CAST(1234567891234567.34 AS NUMERIC(18,10)) --fails with Arithmetic overflow error

it is clear that, in the first case from the statement NUMERIC(18,2) the total digits are 18 and 16 digits are available to the left of decimal, whereas 1234567891234567 are 16 digits. Hence, there is no error.
In the second case, from the statement NUMERIC(18,10), 8 digits are available to the left of decimal, but 1234567891234567 are 16 digits which is more than 8 digits. Hence, Arithmetic overflow error occurs.

Monday, 3 November 2014

Thursday, 30 October 2014

Using SQL Server Metadata and Statistics to Build a Table

select o.name as [Name], sc.name as [Type], s.row_count as [Size]
 from sys.objects o        
left join sys.schemas sc on sc.schema_id = o.schema_id
left join (select object_id, sum(rows) as row_count from sys.partitions 
      where index_id < 2
    group by object_id) s on o.object_id = s.object_id
where o.type = 'U'
order by sc.name, o.name

Extract Table Meta Data (description, fields and their data types)


SELECT   u.name + '.' + t.name AS [table],
            td.value AS [table_desc],
      c.name AS [column],
      cd.value AS [column_desc]
FROM     sysobjects t
INNER JOIN  sysusers u
    ON  u.uid = t.uid
LEFT OUTER JOIN sys.extended_properties td
    ON  td.major_id = t.id
    AND  td.minor_id = 0
    AND  td.name = 'MS_Description'
INNER JOIN  syscolumns c
    ON  c.id = t.id
LEFT OUTER JOIN sys.extended_properties cd
    ON  cd.major_id = c.id
    AND  cd.minor_id = c.colid
    AND  cd.name = 'MS_Description'
WHERE t.type = 'u'
ORDER BY    t.name, c.colorder

Monday, 27 October 2014

Convert the XML to temp table using OPENXML in SQL Server

DECLARE @idoc int

DECLARE @doc varchar(1000)

SET @doc ='
<OutLookContact>
<Contact FirstName="Asif" LastName="Ghafoor" EmailAddress1="asifghafoor@my.web.pk" />
<Contact FirstName="Rameez" LastName="Ali" EmailAddress1="rameezali@my.web.pk" />
</OutLookContact>'

--Create an internal representation of the XML document.

EXEC sp_xml_preparedocument @idoc OUTPUT, @doc

-- Execute a SELECT statement that uses the OPENXML rowset provider.

DECLARE @Temp TABLE(FirstName VARCHAR(250),LastName VARCHAR(250),Email1 VARCHAR(250))  

INSERT INTO @Temp(FirstName,LastName,Email1)



SELECT *

FROM OPENXML (@idoc, '/OutLookContact/Contact',1)

WITH (FirstName varchar(50),LastName varchar(50),EmailAddress1 varchar(50))


select FirstName,LastName,Email1 from @Temp