March 2010
M T W T F S S
« Dec    
1234567
891011121314
15161718192021
22232425262728
293031  

Send SqlDbType.Xml to Store Procedure

SqlCommand command = new SqlCommand(”ReportMultiTruckGeneric”);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(”@startDate”, SqlDbType.DateTime).Value = ProcessStartDate;
command.Parameters.Add(”@endDate”, SqlDbType.DateTime).Value = ProcessEndDate;

StringBuilder sb = new StringBuilder();

sb.Append(”<Trucks>”);
foreach (DataRow row in trucks.Tables[0].Rows)
{
sb.AppendFormat(”<TruckId>{0}</TruckId>”, row["ID"].ToString());
}
sb.Append(”</Trucks>”);

command.Parameters.Add(”@trucks”, SqlDbType.Xml).Value = sb.ToString();

DataSet queryResult = DBHook.SendSQLSelectRequest(command, out ex);

==store procedure=============
ALTER procedure [dbo].[ReportMultiTruckGeneric]
@startDate datetime,
@endDate datetime,
@trucks xml
as


set @trucksCopy = @trucks

select Trucks.TruckId.value(’.’, ‘int’)
from @trucksCopy.nodes(’Trucks/TruckId’) as Trucks(TruckId)

Multi Thread and Delegate

จากรูปข้างล่างนี้เราสามารถที่จะเลือกใส่ทั้ง IP Address , HostName, DNS เพื่อทำการ Ping ได้ครับ

http://greatfriends.biz/webboards/msg.asp?b=SURREALIST&id=21512

http://greatfriends.biz/webboards/msg.asp?b=SURREALIST&id=21512

http://greatfriends.biz/webboards/msg.asp?id=16216

Visual Studio Programmer Themes Gallery

See more themes goto link below

http://www.hanselman.com/blog/VisualStudioProgrammerThemesGallery.aspx
http://blog.wekeroad.com/2007/10/17/textmate-theme-for-visual-studio-take-2/

Unable to start debugging on the web server. You do not have permission to debug the application. The URL for this project is in the Internet zone.

1. In the Internet Explorer, “Tools” Menu, select “Internet Options”.

2. Switch to “Security” Tab.

3. Click on “Internet” (The Globe Icon. Its actually the default selected).

4. Click on “Custom Level” in the bottom.

5. Scroll down to find the “User Authentication” section.

6. Select “Automatic logon with current username and password”.

7. Click “Ok” twice to exit.

ref:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vsdebug.asp

ASP.NET Dynamic Data Preview #7: How Do I Use a DynamicControl in ListView and DetailsView Controls?

This video compares the same application written twice, once with Dynamic Data and once without. In the process, you add DynamicControl objects to ListView and DetailsView controls.

http://msdn.microsoft.com/en-us/library/system.web.dynamicdata.dynamiccontrol.aspx

http://www.bestechvideos.com/2008/06/02/asp-net-dynamic-data-how-do-i-use-a-dynamiccontrol-in-listview-and-detailsview-controls

Sorting Generic List

//Sorting List<> case Item is ListItem
//==============================================
List<ListItem> tempList = new List<ListItem>();

tempList.Insert(0, new ListItem(”————- Vehicle Reports 8″));
tempList.Insert(0, new ListItem(”————- Vehicle Reports 2″));
tempList.Insert(0, new ListItem(”————- Vehicle Reports 4″));

// sort asc
tempList.Sort(delegate(ListItem p1, ListItem p2) {
return p1.Text.CompareTo(p2.Text);
[...]

ThaiBuddhistCalendar and DateTime Convertion

//date time utc
DateTime _utc = DateTime.UtcNow;

// utc –> thai
ThaiBuddhistCalendar tbc = new ThaiBuddhistCalendar();

int thaiDay = tbc.GetDayOfMonth(_utc);
[...]

Convert DateTime Thai – Eng culture (Buddha – Christ Ex. year 2009 is 2552)

public static DateTime DateTimeCulture()
{
//=========================================================
//======== convert year: crist to buddha ==================
int _day, _month, _year;
DateTime _date;
[...]

Tips to optimize design-time build performance for Web Sites in Visual Studio

There have been a number of posts with tips to improve build performance within Visual Studio 2005.  I’ve consolidate these posts and other tips into a single post of techniques for common problems.
ref: http://weblogs.asp.net/bradleyb/archive/2005/12/06/432441.aspx

LINQ to SQL Debug Visualizer

 Probably the biggest programming model improvement being made in .NET 3.5 is the work being done to make querying data a first class programming concept.  We call this overall querying programming model “LINQ”, which stands for .NET Language Integrated Query.  Developers can use LINQ with any data source, and built-in libraries are included with .NET 3.5 that [...]