Coderock

--------------------------------
link hover image

SQL: get previous from max value

Frontpage calendar image November 29, 2015

select max(card_no),vehicle_number FROM WBG.WBG_01_01 where card_no < (Select max(card_no) from WBG.WBG_01_01 group by vehicle_number) group by vehicle_number Source: stackoverflow

link hover image

SQL : Remove Special Characters except Space.

Frontpage calendar image November 14, 2015

DECLARE @str VARCHAR(400) –Add your specialcharacters here DECLARE @specialchars VARCHAR(50) = ‘%[~,@,#,$,%,&,*,(,),.,!^?:]%’ SET @str = ‘KRA!NTHI@#KUMAR, KU%^?MAR GO~()$U.:D’ WHILE PATINDEX( @specialchars, @str ) > 0 —Remove special characters using Replace function SET @str = Replace(REPLACE( @str, SUBSTRING( @str, PATINDEX( @specialchars, @str ), 1 ),”),’-‘,’ ‘) SELECT @str   Source: www.sqlservercentral.com

link hover image

How to export all data from table to an insertable sql format?

Frontpage calendar image November 10, 2015

Quick and Easy way: Right click database Point to tasks Select generate scripts Click next Choose tables Click next Click advanced Scroll to data to script – Called types of data to script in SMSS 2014 Select data only Click next and generate your script Source: stackoverflow

link hover image

The data type of substitution parameter 1 does not match the expected type of the format specification

Frontpage calendar image July 13, 2015

RAISERROR(‘Test Error Number: %d.’,16,1,@MyNumber) When the trigger is executed with the value 1 passed in the @MyNumber parameter, the result is: Msg 2786, Level 16, State 1, trigger trg_delete, Line 19 The data type of substitution parameter 1 does not match the expected type of the format specification. If the datatype for @MyNumber is changed to […]

link hover image

Error:”Index was outside the bounds of the array”

Frontpage calendar image May 24, 2015

I had a problem with “SQL Server Freetext and Contains functions at Godaddy webhosting”. Solution: I upgraded my SqlServer management studio from 2008 to 2012 Or Download the service packs of SqlServer Management Studio and update probably resolve you solution. This solved the prblem. Source: stackoverflow

link hover image

How to get width and height of an image from remote server in asp.net

Frontpage calendar image January 3, 2015

How to get width and height of an image from remote server in asp.net: I am using asp.net 3.5 with c#. I have hosted a site and I want to get width and height of an image from remote server. To avoid error URI formats are not supported, my code look like this: string filePath = string.Format(“http://yoursite.com/Item/{0}”, […]

link hover image

How to remove special characters from string

Frontpage calendar image January 2, 2015

How to remove special characters from string: string str1=Regex.Replace(txtDescription.Text,@”[[]\^$.|?*+(){}%,;><!@#&-+]”,””);

link hover image

jQuery Tags input, comma delimited

Frontpage calendar image January 1, 2015

This plugin will turns each tag into a style-able object with its own delete link. The plugin handles all the data, your form just sees a comma-delimited list of tags! You can download source  or read the full tutorial from here.

link hover image

How to match a comma separated list of emails with regex?

Frontpage calendar image December 30, 2014

  How to match a comma separated list of emails with regex: < asp:RegularExpressionValidator ID=”reg1″ runat=”server” ErrorMessage=”Wrong email format (separate multiple email by comma [,])” ControlToValidate=”txtToEmail” Display=”Dynamic” ValidationExpression=”^([w+-.%]+@[w-.]+.[A-Za-z]{2,4},?)+$”>< /asp:RegularExpressionValidator>

link hover image

ViewState

Frontpage calendar image December 21, 2014

ViewState is the mechanism that allows state values to be preserved across page postbacks. Values stored in ViewState will be serialized and sent to the client browser as the value of a hidden form input. When you view the page source (in your browser) of a page the uses ViewState, you may see this hidden […]