Skip to main content

Posts

SQL : Inserting multiple rows using onq sql query

Following SQL query is used to insert multiple record into table INSERT INTO tmpTable (field1, field2,field3) VALUES  ('74251', 'Black', '511black') INSERT INTO tmpTable  (field1, field2,field3) VALUES  ('74251', 'CharcoalF', '5145') INSERT INTO tmpTable  (field1, field2,field3) VALUES  ('74251', 'KhakiQ', '5165') INSERT INTO tmpTable  (field1, field2,field3) VALUES  ('74251', 'NavyA', '515') INSERT INTO tmpTable  (field1, field2,field3) VALUES  ('74251', 'OD', '511')

Converting Stream to String and String to Bytes

C# : Converting Stream to String and  String to Bytes Following code can be sued for converting stream to string and then stream to bytes. Stream Stream1 = bodyPart.GetOriginalDataStream();                              String test = new StreamReader(Stream1).ReadToEnd();                             System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();                             Byte[] bytes = encoding.GetBytes(test);

Convert BizTalk MessageBodyPart to String

Get MessageBodyPart as string in Custom Pipeline component execute method. In the follwoing code pInMsg.BodyPart is converted to String using stream. You can edit this messsage steam as per your requirement then assign to new message traceDataRequest.Message. Following code can be used for tracing the request message recived by BizTalk pipeline or to modifiy the request received. We have used eventlog entry to log the message for tracing.                            int bufferSize = 0x280; //  TODO move to external config                             int thresholdSize = 0x100000;   //  TODO move to external config              ...

Regular Expression to validate URL

ASP.NET  : Regular expression to validate URL. Regex reg = new Regex(@" @"^(?:ftp|http|https):\/\/(?:[\w\.\-\+]+:{0,1}[\w\.\-\+]*@)?(?:[a-z0-9\-\.]+)(?::[0-9]+)?(?:\/|\/(?:[\w#!:\.\?\+=&%@!\-\/\(\)]+)|\?(?:[\w#!:\.\?\+=&%@!\-\/\(\)]+))?$ "); Response.Write(reg.IsMatch( txtwebsite .Text)); string regURL = @"^(?:ftp|http|https):\/\/(?:[\w\.\-\+]+:{0,1}[\w\.\-\+]*@)?(?:[a-z0-9\-\.]+)(?::[0-9]+)?(?:\/|\/(?:[\w#!:\.\?\+=&%@!\-\/\(\)]+)|\?(?:[\w#!:\.\?\+=&%@!\-\/\(\)]+))?$" ; if ( Regex .IsMatch(txtwebsite.Text, regURL)) { // string match with regExpression. } Else { //String does not validate }