Decimal Validation in asp.net C# :- <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Plz Enter Only Decimal" ControlToValidate="txtMRP" ValidationExpression="^-?[0-9]{0,5}(\.[0-9]{1,2})?$|^-?(100000)(\.[0]{1,5})?$"></asp:RegularExpressionValidator> {0,5} - Indicate no.of digit to be allowed, so customized as per requirement.
Posts
Showing posts from 2012
- Get link
- X
- Other Apps
i ve to display data in commas in sql :- Returning a Comma CREATE FUNCTION dbo.fn_GetTherapistName(@AppCode int) RETURNS VARCHAR(1000) AS BEGIN DECLARE @StudentList varchar(1000) --SELECT @StudentList = COALESCE(@StudentList + ', ', '') + CAST(m.TherapistId AS VARCHAR(15)) --FROM multipleTherapy m --WHERE m.AppCode = @AppCode SELECT @StudentList = COALESCE(@StudentList + ', ', '') + CAST(dbo.staff_Master.firstname AS VARCHAR(100)) FROM dbo.multipleTherapy INNER JOIN dbo.staff_Master ON dbo.multipleTherapy.TherapistId = dbo.staff_Master.empcode WHERE (dbo.multipleTherapy.AppCode = @AppCode) RETURN @StudentList END
- Get link
- X
- Other Apps
To Display Current Week data in sql :- CREATE FUNCTION dbo.udf_DisplayCurrentWeekDateDays ( @today SMALLDATETIME ) RETURNS @WeekDateDay TABLE ( Sunday SMALLDATETIME , Monday SMALLDATETIME , Tuesday SMALLDATETIME , Wednesday SMALLDATETIME , Thursday SMALLDATETIME , Friday SMALLDATETIME , Saturday SMALLDATETIME ) AS BEGIN DECLARE @day INT SET @today = CAST ( CONVERT ( VARCHAR ( 10 ), @today , 101 ) AS SMALLDATETIME ) SET @day = DATEPART ( dw , @today ) INSERT INTO @WeekDateDay ( Sunday , Monday , Tuesday , Wednesday , Thursday , Friday , Saturday ) SELECT DATEADD ( dd , 1 - @day , @today ) Sunday , DATEADD ( dd , 2 - @day , @today ) Monday , DATEADD ( dd , 3 - @day , @today ) Tuesday , DATEADD ( dd , 4 - @day , @today ) Wednesday , DATEADD ( dd , 5 - @day , @today ) Thursday , DATEADD ( dd , 6 - @day , @today ) Friday , DATEADD ( dd , 7 - @day , @today ) Saturday RETURN END GO for more reference :- http://blog.sqlauthority.com/2007/06/08/sql-server-...
- Get link
- X
- Other Apps
How to convert table data from horizontal into vertical in sql :- declare @t table (id int, nm varchar(10), typ varchar(10), color varchar(10), qty int, txt varchar(10)) insert @t select 1, 'name1', 'type1', 'color1', 10, 'note1' union all select 2, 'name2', 'type2', 'color2', 20, 'note2' select up.id ,up.col as sourcecolumn ,up.val as [value] from ( select id, nm,typ,color,convert(varchar(10), qty) qty,txt from @t --YOUR TABLE ) d unpivot (val for col in ([nm], [typ], [color],[qty],[txt])) up
- Get link
- X
- Other Apps
Varieties of dates available in sql server :- Declare @Date datetime SET @Date = '1/1/2011' WHILE @Date < '1/1/2012' BEGIN SELECT CONVERT(VARCHAR(8), @Date, 112) date1, @Date fulldate, YEAR(@Date) years, DATEPART(qq, @Date) quater, DATEPART(ww, @Date) yearweeks, DATENAME(dw, @Date) dayname, DATEPART(dd, @Date) dateno, DATENAME(mm, @Date) monthnam, DATEPART(dy,@Date) daycnt, DATENAME(mm, @Date) + ' ' + CAST(DATEPART(dd, @Date) AS CHAR(2)) + ',' + CAST(DATEPART(yy, @Date) AS CHAR(4)) [mm dd,yyyy], CONVERT(VARCHAR(10), @Date, 101) normaldate, DATEPART(dw, @Date) , DATEPART(mm, @Date) dateno SET @Date = DATEADD(dd, 1, @Date) END
- Get link
- X
- Other Apps
Difference Between @@identity , scope_identity() and ident_Current('tablename'):- SELECT @@IDENTITY @@IDENTITY is limited to the current session, it is not limited to the current scope. SELECT SCOPE_IDENTITY() SELECT IDENT_CURRENT(‘tablename’) IDENT_CURRENT is not limited by scope and session; it is limited to a specified table.
- Get link
- X
- Other Apps
What is the information stored in the master database ? The master database holds information for all databases located on the SQL Server instance and is the glue that holds the engine together. Because SQL Server cannot start without a functioning master database, you must administer this database with care. The msdb database stores information regarding database backups, SQL Agent information, DTS packages, SQL Server jobs, and some replication information such as for log shipping. The tempdb database holds temporary objects such as global and local temporary tables and stored procedures. The model database is essentially a template database used in the creation of any new user database created in the instance.
- Get link
- X
- Other Apps
How do I Secure My Connection String In web.config file Go to start , search for Windows Explorer Right click on windows explorer, and then select Run as an Administrator. Go to C: drive , Go to Tools Menu , Select Folder Options , in View tab Click show hidden files, folder and drives. Now , you will able to see ProgramData (hidden folder) Now Go this path C:\ProgramData\Microsoft\Crypto\RSA, you will get MachineKeys Folder For accessing MachineKeys folder you must have full access control as a user. Right click MachineKeys folder, select properties, then go to security tab. In Group or User names, select everyone, for permission, click edit to provide full access to it. Check all under Allow permission checkboxes then click OK again click Apply and OK button for completion of permission to user everyone. After providing access permission to everyone user, go to run, type CMD. Go to path , C:\Windows\Microsoft.NET\Framework\v4.0.30319 ,copy path and paste in CMD In CMD, type CD <s...
- Get link
- X
- Other Apps
To resolve " Validation of viewstate MAC failed ". Here , website url for generating machine key: http://aspnetresources.com/ tools/machineKey here example given below after generating machine key through above web url This is the code which needs to be put in web.config file, hope it will help you out. <system.web> <machineKey validationKey=" 7B1A0112BEDDADE43C71702052E666 F5D5DDD8CB053F085E5362DFB1B20E 29266B8D47AE0F6C3A9E370C0192ED 1C488961F7D944A21ABF9AC2186E84 58A2FB17" decryptionKey=" EBCE0AD022C8A711670C4C96BB87C4 B91A3B0DF509B579222E1410003BE4 532B" validation="SHA1" decryption="AES" /> < /system.web>