Thursday, December 17, 2009

Nth maximum salary employee details from employee table

replace n with any number.
Example : 2nd Highest,3rd highest......


SELECT * FROM emp E1 WHERE n = (SELECT COUNT(DISTINCT(E2.esal))FROM emp E2 WHERE E2.esal >= E1.esal)

Accessing Database from Pure HTML page





Call Log Details






Retrieving a Image from database and visualizing in Gridview Image based on the primary key column

Gridview
---------------------



ImageUrl='<%#"StaffHandler.ashx?id=" & Eval("staffid")%>'
idth="171px" Height="200px" />





-----------------------------
StaffHandler.ashx
-----------------------------

<%@ WebHandler Language="VB" Class="Handler" %>

Imports System
Imports System.Web
Imports System.Data.SqlClient

Public Class Handler : Implements IHttpHandler

Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Try
Dim myConnection As New SqlConnection
Call DBConnect(myConnection)

Dim sql As String = "Select photo from staff_details where staffid=@staffid"

Dim cmd As New SqlCommand(sql, myConnection)
cmd.Parameters.Add("@staffid", System.Data.SqlDbType.VarChar, 50).Value = context.Request.QueryString("id")
cmd.Prepare()
Dim dr As SqlDataReader = cmd.ExecuteReader()
dr.Read()
context.Response.BinaryWrite(DirectCast(dr("photo"), Byte()))
Catch
End Try
End Sub

Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property

End Class

'''''''''''''''''''''''''''''''''''''''''
In Button CLick or timer_tick
'''''''''''''''''''''''''''''''''''''''''

Dim sql As String = "Select staffid,photo from staff_details where staffid='" & ds.Tables(0).Rows(count)(0).ToString() & "'"

Dim ada As New SqlDataAdapter(sql, con)
Dim dt As New DataTable()
ada.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()

'''''''''''''''''''''''''''''

Storing images in database (sqlserver) vb.net code

Here fup1 means file upload control

Dim intImageSize As Int64
Dim strImageType As String
Dim ImageStream As Stream

intImageSize = fup1.PostedFile.ContentLength
strImageType = fup1.PostedFile.ContentType
ImageStream = fup1.PostedFile.InputStream
Dim ImageContent(intImageSize) As Byte
Dim intStatus As Integer
intStatus = ImageStream.Read(ImageContent, 0, intImageSize)
Dim myCommand As New SqlCommand("update staff_details set photo= @imgsamgetimage where staffid='" & Emp(2) & "'", Conn)
myCommand.Parameters.Add("@imgsamgetimage", SqlDbType.Image, ImageContent.Length).Value = ImageContent
myCommand.ExecuteNonQuery()
Conn.Close()

Wednesday, December 16, 2009

Working With Ajax CalendarExtender Control or apply ajax calender to textbox





PopupButtonID="Image1" PopupPosition="Right" />

(Check calendar)




post u r doubts

working with ajax Accordion control

HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected"
ContentCssClass="accordionContent" FadeTransitions="false" FramesPerSecond="40"
TransitionDuration="250" AutoSize="None" RequireOpenedPane="false" SuppressHeaderPostbacks="true">



1. Personal Details:



Design as useusal like how u can design u r page





1. Personal Details:



Design as useusal like how u can design u r page




1. Personal Details:



Design as useusal like how u can design u r page




Add a Flash Object or .SWF file in asp.net page

Add Flash dll to your project references

-------------
FlashControl.dll
-------------

copy the code in source file of asp.net





or

Go to tool box choose items --> select flash dll and add the control.
flash control will be present in the tool box.
drag and drop the flash control over the page where u want to be.
set the properties listed below

Width :
Height:
MovieUrl:
Loop :
Play :


Now execute u r site by setting the page as startup page.
u can see the flash object in u r page



Any doubts plase feel free to post