Saturday, September 28, 2013

Save images to database using SQL


Most of the time we want to save store/save images to database. In order to store image on sql server we need to store that in binary format. the most easiest way to do so in execute the SQL OPENROWSET command with SINGLE BLOB & BULK options.


Let's create one sample table and insert the sample result in it.


create table imageSave
(
   [img_name] varchar(250),
   [Img_binary] varbinary(max)
)

will insert some sample result into the imageSave table.

Insert into imageSave

SELECT 'SAMPLE Image', *

FROM OPENROWSET(BULK N'F:\Images\sample-test.jpg', SINGLE_BLOB) image;

Admin(sa) & developer has rights to work with OPENROWSET command.



Tuesday, September 24, 2013

Find Header & Footer template from Repeater control in .Net



This article will explain you how to find the Repeater Header and Footer template details.

I had created one user control which contain the Repeater. It generate the product showcase. i used that control in multiple pages but some where i need to update few details like header title , footer text at run time and that i have achieved it through find control.
Below example can helps you to understand the clear idea.


<asp:Repeater ID="ProductsDetails" runat="server">  
<HeaderTemplate> 
     <asp:Label ID="lblProductDetails" runat="server" Fore-Color= "Red"  Font-Bold = "true" />
 <br />  
</HeaderTemplate>  
<ItemTemplate>      
 Product Name : <%#Eval("Name") %> <br />  
</ItemTemplate>  
<FooterTemplate>      
 <asp:Label ID="lblPriceDetails" runat="server" Fore-Color= "Green" Font-Bold = "true" />  
</FooterTemplate>
</asp:Repeater>


Here i have define repeater control along with header & footer details , now i want to change the text of label called "lblProductDetails" at run-time. below snippets will helps you to get the Repeater details and base on that you can easily find the footer  & header controls  and change the text.


//Find HeaderTemplate
   Control TempHeaderDet = ProductsDetails.Controls[0].Controls[0];      
   Label lblHeaderDet = TempHeaderDet.FindControl("lblProductDetails") as Label;      
   lblHeaderDet.Text = "Product Description :";

//Find FooterTemplate

   Control FooterTemplateDet = ProductsDetails.Controls[ProductsDetails.Controls.Count - 1].Controls[0];            
   Label lblFooterDet = FooterTemplateDet.FindControl("lblPriceDetails") as Label;      
   lblFooter.Text = "Product Price:";



Yeap, i know its not very big deal... but yes some time this trick will helps you and save time as well. 

put your comments/ question in case of any concerns.

 

Friday, September 6, 2013

Andriod KitKat

Yes, once again andriod version has been named base on dessert.

after the cupcake, donut, Gingerbread, ice-cream sandwish and jelly beans. new decided name of next version of andriod as favourite chocolate "Kit Kat".

Android 4.4 KitKat

As andriod says people can easily remember such name because they can't leave without chocoates. :)

Here are the some versions of Android in Pictures













    Looks good, isn't it?   Post your comments and queries to know more about KitKat