http://rawatsumit.blogspot.com/2009/09/tips-and-tricks-importing-excel-sheet.html
http://davidschrag.com/schlog/201/importing-excel-2007-spreadsheets-into-wss-30-using-vista
Steps to Import spearsheet:
Main Site -> click List -> Create -> Import spearsheet -> choose Xls -> select the range -> Import
Tuesday, May 4, 2010
Tuesday, March 23, 2010
Generic list Example
GenericSampleClass.aspx.cs:
---------------------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
public partial class wfGenericSampleWithArg : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GenericSampleWithArg objGenericSampleWithArg = new GenericSampleWithArg();
objGenericSampleWithArg.Push(9);
int Resultint = objGenericSampleWithArg.pop();
GenericSampleWithArg objGenericSampleWithArgstring = new GenericSampleWithArg();
objGenericSampleWithArgstring.Push("sri");
string Resultstring = objGenericSampleWithArgstring.pop();
drpCollection.DataSource = GetUserWithArg();
drpCollection.DataBind();
drpCollectionwithCalss.DataTextField = "userName";
drpCollectionwithCalss.DataSource = GetUserswithClass();
drpCollectionwithCalss.DataBind();
}
private object GetUserWithArg()
{
ListItemCollection addtCollection = new ListItemCollection();
for (int i = 0; i <= 5; i++)
{
addtCollection.Add(new ListItem("sri" + i.ToString()));
}
this.lstCollection = addtCollection;
return this.lstCollection;
}
private List GetUserswithClass()
{
List objListGenericSampleWithArg = new List();
for (int j = 0; j <= 9; j++)
{
objListGenericSampleWithArg.Add(new genericSamplewithClass(j, "sri" + j.ToString()));
}
this.users = objListGenericSampleWithArg;
return this.users;
}
private ListItemCollection _lstCollection;
public ListItemCollection lstCollection
{
get
{
return _lstCollection;
}
set
{
_lstCollection = value;
}
}
private List _users;
public List users
{
get
{
return _users;
}
set
{
_users = value;
}
}
}
genericSamplewithClass.cs:
--------------------------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///
/// Summary description for genericSamplewithClass
///
public class genericSamplewithClass
{
public genericSamplewithClass()
{
//
// TODO: Add constructor logic here
//
}
public genericSamplewithClass(int userId, string userName)
{
this.userId = userId;
this.userName = userName;
}
public genericSamplewithClass(int userId, string userName, string address)
{
this.userId = userId;
this.userName = userName;
this.address = address;
}
private string _userName;
private int _userId;
private string _address;
public int userId
{
get
{
return _userId;
}
set
{
_userId = value;
}
}
public string userName
{
get
{
return _userName;
}
set
{
_userName = value;
}
}
public string address
{
get
{
return _address;
}
set
{
_address = value;
}
}
}
---------------------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
public partial class wfGenericSampleWithArg : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GenericSampleWithArg
objGenericSampleWithArg.Push(9);
int Resultint = objGenericSampleWithArg.pop();
GenericSampleWithArg
objGenericSampleWithArgstring.Push("sri");
string Resultstring = objGenericSampleWithArgstring.pop();
drpCollection.DataSource = GetUserWithArg();
drpCollection.DataBind();
drpCollectionwithCalss.DataTextField = "userName";
drpCollectionwithCalss.DataSource = GetUserswithClass();
drpCollectionwithCalss.DataBind();
}
private object GetUserWithArg()
{
ListItemCollection addtCollection = new ListItemCollection();
for (int i = 0; i <= 5; i++)
{
addtCollection.Add(new ListItem("sri" + i.ToString()));
}
this.lstCollection = addtCollection;
return this.lstCollection;
}
private List
{
List
for (int j = 0; j <= 9; j++)
{
objListGenericSampleWithArg.Add(new genericSamplewithClass(j, "sri" + j.ToString()));
}
this.users = objListGenericSampleWithArg;
return this.users;
}
private ListItemCollection _lstCollection;
public ListItemCollection lstCollection
{
get
{
return _lstCollection;
}
set
{
_lstCollection = value;
}
}
private List
public List
{
get
{
return _users;
}
set
{
_users = value;
}
}
}
genericSamplewithClass.cs:
--------------------------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
///
/// Summary description for genericSamplewithClass
///
public class genericSamplewithClass
{
public genericSamplewithClass()
{
//
// TODO: Add constructor logic here
//
}
public genericSamplewithClass(int userId, string userName)
{
this.userId = userId;
this.userName = userName;
}
public genericSamplewithClass(int userId, string userName, string address)
{
this.userId = userId;
this.userName = userName;
this.address = address;
}
private string _userName;
private int _userId;
private string _address;
public int userId
{
get
{
return _userId;
}
set
{
_userId = value;
}
}
public string userName
{
get
{
return _userName;
}
set
{
_userName = value;
}
}
public string address
{
get
{
return _address;
}
set
{
_address = value;
}
}
}
Wednesday, March 10, 2010
Count work days between two dates in SQL
declare @StartDate datetime,@EndDate datetime
select @StartDate='3/2/2010', @EndDate='3/7/2010'
DECLARE @TotalDays INT,@WorkDays INT
DECLARE @ReducedDayswithEndDate INT
DECLARE @WeekPart INT
DECLARE @DatePart INT
SET @TotalDays= DATEDIFF(day, @StartDate, @EndDate) +1
SELECT @ReducedDayswithEndDate = CASE DATENAME(weekday, @EndDate)
WHEN 'Saturday' THEN 1
WHEN 'Sunday' THEN 2
ELSE 0 END
SET @TotalDays=@TotalDays-@ReducedDayswithEndDate
SET @WeekPart=@TotalDays/7;
SET @DatePart=@TotalDays%7;
SET @WorkDays=(@WeekPart*5)+@DatePart
SELECT @WorkDays
select @StartDate='3/2/2010', @EndDate='3/7/2010'
DECLARE @TotalDays INT,@WorkDays INT
DECLARE @ReducedDayswithEndDate INT
DECLARE @WeekPart INT
DECLARE @DatePart INT
SET @TotalDays= DATEDIFF(day, @StartDate, @EndDate) +1
SELECT @ReducedDayswithEndDate = CASE DATENAME(weekday, @EndDate)
WHEN 'Saturday' THEN 1
WHEN 'Sunday' THEN 2
ELSE 0 END
SET @TotalDays=@TotalDays-@ReducedDayswithEndDate
SET @WeekPart=@TotalDays/7;
SET @DatePart=@TotalDays%7;
SET @WorkDays=(@WeekPart*5)+@DatePart
SELECT @WorkDays
Subscribe to:
Comments (Atom)