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

Sql Server Tip 3

Tip#3: Try to use CAST instead of CONVERT. CAST is ANSI-92 standard but CONVERT works in MS SQL server only. Also, some CONVERT styles may be deprecated in future MS SQL releases.

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)

What is Google Public DNS?

http://code.google.com/intl/th-TH/speed/public-dns/

ไปตั้งค่า DNS เป็น 8.8.8.8 กับ 8.8.4.4 นะครับ ผลคือเน็ตผมเร็วขึ้นกว่าเดิมมากๆเลย

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

New line in crystal report formular

chr(13)

Test syntax hilighter

class=”brush: c-sharp; ”

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1
{
    /* test hilighter */
    class ClassAddress
    {
        public string Name { get; set; }
        public string Street1 { get; set; }
        public string Street2 { get; set; }
        public string CityName { get; set; }
        public string StateOrProvince { get; set; }
        public string CountryName { get; set; }
        public string PostalCode { get; set; }
    }
}

class=”brush: php; html-script: true”—–
class=”brush: css; html-script: true”

.class1{
   background-color: Red !important;
}

class=”brush: csharp; html-script: true”

Visual Studio Programmer Themes Gallery

image

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/

Problem with searching thai text in ms sql

Try this :

Select * from Table1 WHERE (ColumnName like N’%Values%’)

Select * from Table1 WHERE (ColumnName = N’%Values%’)

or

Select * from Table1 Where (ColumnName collate Thai_bin like N’%Values%’)

Select * from Table1 Where (ColumnName collate Thai_bin = N’%Values%’)

Format number in gridview

<asp:BoundField DataField=”prodPrice” HeaderText=”Price” HtmlEncode=”False” DataFormatString=”{0:f0}” />

Or in TemplateField

<asp:TemplateField HeaderText=”Price”>
<ItemTemplate>
<%#Eval(“prodPrice”,”{0:f0}”)%>
</ItemTemplate>
</asp:TemplateField>

Ex: {0:f0} is integer, {0:f1} is decimal with  1 digit

Google Wave