Posts

Showing posts from 2016

How to Upload Image to DB in SQL

Follow the steps below to upload Image to SQL in your Asp.Net website 1) Create a Table in you DB. CREATE TABLE [dbo].[CustomerDetails] (     [ID]           INT            IDENTITY (1, 1) NOT NULL,     [CustomerName] NVARCHAR (MAX) NULL,     [ Address ] NVARCHAR (MAX) NULL,       [Latitude]     FLOAT (53)     NULL,     [Longitude]    FLOAT (53)     NULL,     [Image]        IMAGE          NULL,     CONSTRAINT [PK_CustomerDetails] PRIMARY KEY CLUSTERED ([ID] ASC) ); 2) Create a new application. Add a FileUpload Control A Button. 3) In your Button click event  paste the code below. try             {                 if (FileUpload1.HasFile)                 {                     //getting length of uploaded file                     int length = FileUpload1.PostedFile.ContentLength;                     //create a byte array to store the binary image data                     byte[] imgbyte = new byte[length];                     //store the currently selected file in

How to show multiple markers on Google maps from database in ASP.Net

A simple way to show multiple markers on Google maps from database in ASP.Net using SQL and Repeater. Follow the steps below: 1) Create a Table in you DB. CREATE TABLE [dbo].[CustomerDetails] (     [ID]           INT            IDENTITY (1, 1) NOT NULL,     [CustomerName] NVARCHAR (MAX) NULL,     [ Address ] NVARCHAR (MAX) NULL,       [Latitude]     FLOAT (53)     NULL,     [Longitude]    FLOAT (53)     NULL,     [Image]        IMAGE          NULL,     CONSTRAINT [PK_CustomerDetails] PRIMARY KEY CLUSTERED ([ID] ASC) ); 2) HTML Markup and Google Maps Scripts <script src="http://maps.google.com/maps/api/js?libraries=places&key=YOUR-APIKEY-HERE"></script> <script type="text/javascript">          var markers = [          <asp:Repeater ID="rptMarkers" runat="server">          <ItemTemplate>                      {                          "title": '<%# Eval(" CustomerName ") %