2010-11-3

来源:互联网 发布:淘宝千牛怎么发货 编辑:程序博客网 时间:2024/05/27 06:12

>>JavaScript:(>>JS)

*JS replace: (>>JS replace string)

       varcodeJS = codeHTML.replace(/<br//>/g,"/n");

 

*JS window:(>>JSwindows>>Javascript windows)

       ---->>Load window----(>>Load js window>>JS windo onload evnet)

              ##----JS----##

              <scriptlanguage=”text/javascript”>

                     functioninit()

                     {

       ….

}

              </script>

              window.onload=init;

              window.onunload=GUnload;//(>>JSwindow unload event>>Google map unload event>>Unload google map)

 

*JS change child ddl value: (>>javascriptchange child ddl>>JS change child ddl value>>JS change ddl value)

       ####----Example1----####

       ##----JS----##

              varcountriesAndCites = new Array();//(>>Newjs array>>Js array)

 

        countriesAndCites['Australia'] = ['Brisbane','Melbourne', 'Sydney'];

        countriesAndCites['England'] = ['Liverpool','London', 'Manchester'];

        countriesAndCites['Germany'] = ['Berlin','Hamburg', 'Munich'];

        countriesAndCites['USA'] = ['Chicago','Los Angeles', 'NewYork'];

 

        functionChangeSecondDropContent(select1, select2) {

            var country =select1.options[select1.selectedIndex].text;

            varselect2 = document.getElementById(select2);

 

            //removes all options from select 2//(>>Foreach ddl options)

            while(select2.options.length) {

                select2.options.remove(0);//(>>Clearddl items>>Remove ddl items>>Clear Ddl options>>Delete allddl items)

            }

            //adds new options to select 2

            varcountryArray = countriesAndCites[country];

 

            if(countryArray) {

                for(var i = 0; i < countryArray.length; i++) {

                    varoption = new Option(countryArray[i], i);

                   select2.options.add(option);//(>>JS add ddl option>>Addoption to ddl>>Add ddl option>>Add ddl items)

                }

            }

        }

       ##----HTML----##(>>DDLonchange event>>DDL event)

           <asp:DropDownList ID="DropDownList1" runat="server" onchange="ChangeSecondDropContent(this,'DropDownList2');">

        <asp:ListItem Value="1">Australia</asp:ListItem>

        <asp:ListItem Value="2">England</asp:ListItem>

        <asp:ListItem Value="2">Germany</asp:ListItem>

        <asp:ListItem Value="2">USA</asp:ListItem>

        </asp:DropDownList>

 

         <asp:DropDownList ID="DropDownList2" runat="server">

        </asp:DropDownList>

 

 

*JS DT:(>>JS DT>>JS dateTime)

--- >>Get JS DT----

       functionUser(name,age)

{

              varyear=(new Date()).getFullYear()-age;//(>>JS get year>>JS get fullyear>>get year>>New date())

              this.getYearBorn=function()

{

Return year;
};

       }

 

*JS constructor:(>>JS constructor)

---- >>New object byconstructor----(>>JS constructor create object>>Constructor newobject)

       ##----JS----##

           functionUser() { }

        var me= new User();

        var you= me.constructor();//you==me

 

*JS object: (>>JS object>>JavascriptObject)

---- >>Create JS object----(>>jscreate object)

       ##----JS----##

           var obj = newObject();

        obj.val = 5;

        obj.click = function() {//(>>JS click event>>Object onclick event>>Set objectclick event)

            alert("Hello.");

        }

 

 

*Debug JS:(>>Debug JS>>DebugJavascript>>VS debug JS>>VS debug Javascript)

[Step]

              1.”Tool”->”InternetOption”->”Advanced”,unchecked two options named “Forbid script debug(IE)”and “Forbid script debut(Other)” respectively.

              2.Add“debugger;” in js as a breakpoint, like this:

                     ##----JS----##

                     <script language="javascript">

    function test() {

        debugger;//(>>JS debugger)

        var i = 0;

        var j = i + 2;

       alert(j);

    }

</script>

              3.Just run the page with the debuggingjs, and then it will pop up a window for you to choose the debug tool, like VS.

 

*JS and Table:(>>Js andtable>>Javascript and table)

---->>JS set cell value----(>>JSset table cell value>>Set table cell value>>Set table value)

    ##----JS----##

    varoTable=document.getElementById("member");

   oTable.rows[3].cells[4].innerHTML="lost";//(>>JSinnerHTML>>JS set value)

---->>JS delete row----(>>Deleterow>>JS delete table row>>Delete table row)

    ##----JS----##

    varoTable=document.getElementById("member");

   oTable.deleteRow(2);//delete 2nd row, and the 3rd will become 2nd rowautomatically.

   oTable.rows[2].deleteCell(1);//Delete the 2nd cell.(>>Deletecell>>JS delete cell>>JS delete table cell)

 

*Javascript and C#:(>>javascript and c#>>javascriptand .net>>JS and C#)
---->>JS use C# code----(>>JS use C# function)
    ####----Example1----####
    ##----HTML----##
        <asp:HiddenFieldID="HiddenField1" runat="server" />
        <asp:HiddenFieldID="HiddenField2" runat="server" />
    ##----JS----##
        <scriptlanguage="javascript">
            function getText() {
            var txt =document.getElementById("<%=TextBox1.ClientID %>")
            var txt2 =document.getElementById("<%=TextBox2.ClientID %>")
            var hdf =document.getElementById("<%=HiddenField1.ClientID %>")
            var hdf2 =document.getElementById("<%=HiddenField2.ClientID %>")
            hdf.value =txt.value;
            hdf2.value =txt2.value;
           txt.value="<%=GetMyText() %>";
            <%=GetMyText()%>//You can use the function like this without ""
        }
        }
    ##----Code----##
    protected string GetMyText()
    {
        if(IsPostBack)
        {
           hst[this.HiddenField2.Value] = this.HiddenField1.Value;
        }
        return "Test Value from C#code.";
    }
    ####----Example2----####
    ##----JS----##    
    <script language="javascript">
    function SubmitKeyClick()
    {
        if (event.keyCode == 13)
    {
    event.cancelBubble = true;
    event.returnValue = false;
    document.all.FunName.value="
你要调用的函数名"
    document.form[0].submit();
    }
}
</script>
    ##----HTML----##
    <INPUT onkeypress="SubmitKeyClick()"id="aaa" type="text">//(>>Press keyevent>>On key press event>>Textbox press key event)
    <input type="hidden"name="FunName"> 


*JS file:(>>Javascript File>>JS File)

---->>Add Js File----(>>insert jsfile>>insert javascript file>>how to add js file>>how toinsert js file>>reference js file>>How to add javascriptfile>>How to insert javascript file)

    Example 1.

*Javascript summary:(>>jssummary>>javascript summary)

    1.When using the function,you can either use the semicolon or not, like this. //(>>use javascriptfunctions>>how to use js function)

    2.JS have to foreach keyword, if you want to use foreach, you should do, like this, or use jQuery .each(), like this.(Youshould use for in to foreach in js,like 

this.)

    3.JS array do not need tospecify the capacity of array when newing the array by var ary=newarray();, you can add the items in the array directly, by 

ary[0]="jim";, like this.

    4.For In in JSmeans for(int i=0;i<ary.Length;++){} in C# language, see this.

    5.varvar=document.getElementsByTagName("input") is plural with "s" inElements, pay attention to it, this sentence (Bold characters) isget all the textbox, including:<ASP:TextBox> and <inputtype="text"> in aspx page at the same time,like this.

    6.If you need to add the third tier single quotation markin JS function you should use /' to make it, like this(Red color part).

 

*Javascript and DDL:(>>Javascript and ddl>>JSand DDL>>js ddl>>Js and dropdownlist)
---->>Get DDL Value----(>>JS get DDL value>>DDLEvent>>ddl onchange event)
        ####----Example1----####
            ##----HTML----##
                 <asp:DropDownList ID="DropDownList1"runat="server" onchange="ddlChange();">
                      <asp:ListItem>Tom</asp:ListItem>
                      <asp:ListItem>Mark</asp:ListItem>
                      <asp:ListItem>Jim</asp:ListItem>
               </asp:DropDownList>
               <asp:TextBox ID="TextBox1" runat="server" />
               <asp:Label ID="Label1" runat="server"Text="Label"/>
            ##----JS----##
                   <script language="javascript">
                       function ddlChange() {
                           var ddl =document.getElementById("<%=DropDownList1.ClientID%>");//(>>Get Control client id>><%%> to get control)
                           var txt = document.getElementById("TextBox1");
                           var lbl =document.getElementById("<%=Label1.ClientID %>");
                           txt.value =ddl.options[ddl.selectedIndex].text;//(>>Dropdownlist selectedindex>>JS get ddl selected index>>JS get ddl selectedtext>>JS set textbox text>>JS and textbox>>js set texboxtext)
                           lbl.innerHTML =txt.value;//(>>JS set label text>>Innerhtml)
                          alert(txt.value);
                       }
                   </script>

       ####----Example2----####

       ##----HTML----##

       <selectid="ddlViewBy">

<option value="1">test1</option>

<option value="2"selected="selected">test2</option>

<option value="3">test3</option>

</select>

       ##---JS----##

var e = document.getElementById("ddlViewBy");

var strUser = e.options[e.selectedIndex].value;//(>>JSget ddl value>>JS get ddl current value)

 

var e = document.getElementById("ddlViewBy");

var strUser = e.options[e.selectedIndex].text;//(>>JSGet ddl current text>>JS get ddl text>>JS get dropdownlist text)

 

---->>Check DDLselection----(>>JS check ddl selection>>JS get ddl selection)

   ####----Example1----####    

       ##----JS----##

           <script language="javascript">

               var oForm=document.forms["myForm1"];//(>>JS get forms)

               var oSelectBox=oForm.selectionID;

               variChoice=oSelectBox.selectedIndex;//(>>JS get ddl selected index)

               alert("你选中了"+oSelectBox.options[iChoic].text);//(>>JS get ddl text>>JS get dropdownlist text)

           </script>

       ##----HTML----##

           <select id="selectionID"name="selectionID"

               <option value="Aries"selected="selected">白羊</option>

               <optionvalue="Apple">苹果</option>

           </select>

    ####----Exmple2----####

       ##----JS----##

           <script language="javascript">

               varoForm=document.forms["myForm1"]; //(>>JS get forms)

               var oSelectBox=oForm.selectionID;

               var oChoices=new Array();//(>>JS array>>New js>>New js array )

               for(vari=0;i<oSelectBox.options.length;i++)//(>>Foreach js ddl>>foreachddl)

               {

                  if(oSelectBox.options[i].selected)

                      oChoices.push(oSelectBox.options[i].text);//(>>add item to jsarray>>add value to js array)

               }               

               alert("你选中了"+oChoices.join()); //(>>output jsarray values)

           </script>

 

>>Int32:

*Int32 Try:(>>Int32 Try>>TryInt32>>Int try>>Int32.TryParse)

http://jims57.blog.163.com/blog/static/951361720102293136122/

*Int Null:(>>Int Null Value)
---->>Define Int null value----(>>Int Null variable)
[.Net]
    ##----Code----##
    int? x;
    x=null;
    //(>>Set int null value>>Set int asnull>>null int value)//This way can ONLY be used for the Value Type, theReference Type variable can not use it, like string? str; is wrong.
    ##----Code(Function)----##
      private void test(int? i)
    {
        if(i==null)
        {
            string s ="f";
        }
    }
    //It has it from .Net 2.0.By default, null is just forreference type, not value type(Like int), so if you want to make the value typevariable to have the null value, please set it by this.
    //null
是引用类型变量的默认值。那么也只有引用型的变量可以为NULL,如果 int i=null,的话,是不可以的,因为Int是值类型的(But it is changed the rule from .Net 2.0)

 

>>Google:

*Google Maps: (>>GoogleMaps>>Maps)

---- >>google map events----

       ---->>Google map onclick event----

              ##----JS----##

function MyClass()
{

       this.counter=0;

       this.map=newGMap2(document.getElementById(“map”));

       this.map.setCenter(newGLatLng(39,116),10);//(>>Set google map center>>Newlatitude>>New longitude)

       GEvent.bind(this.map,”click”,this,this.onMapClick);//(>>Bindevent to object>>Bind google map event to object>>add Google maponclick event)

}

 

//>>Google map on click

MyClass.prototype.onMapClick=function()

{

this.counter++;

alert(“You have click the map”+this.counter+””+(this.counter==1?”time”:”times”));//(>>JS iif>>JS ?:>>Javascript IIF>>Javascript ? :)
}

 

var myClass=new MyClass();//(>>Js newobject)

 

       ---->>Google map right click event----

       GEvent.addListener(map,”singlerightclick”,function(){…});//(>>Google map right click event>>Add google map right clickevent>>Google map event>>Google right click)

 

---- >>Google map coordinate----(>>Googlemap location)

       ---->>Get google map coordinate----(>>Get google maplocation>>Get google map longitude>>Get Goole map latitude)

       ##----JS----##

       varloc=new GLatLng(29,69);

       //varlat = map.getCenter().lat();

       //varlng = map.getCenter().lng();

 

---- >>Google Maps API----(>>MapsAPIs>>Google APIs>>Google map api)

       [Data]

              http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js//(>>Google local search interface>>Local search JS)

                   http://sourceforge.net/projects/gwt///Open source project (>>Google Open source project>>Open sourceproject)

         [Path]

                   H:/Jim57Data/Google/MapsAPI

---- >>Sign up Google MapsAPI----(>>Get google maps api license>>Get googlelicense>>Sign up Google Maps license)

         [Link]

                   http://code.google.com/intl/zh-cn/apis/maps/signup.html

---- >>Set up Google Maps APIIDE----(>>Google Development environment>>Google Maps APIDevelopment environment)

---- >>how to use google map api----(>>Howto use google Maps api>>use google map)

         [Step]

                   1.RegisterGoogle account.

                   2.GetMaps API KEY at link.

                            //Youhave to register the domain for the website usage of the Google Maps API.e.g:you will register http://www.vg163.com toget a key which can be used Only for the domain and its sub-domain , like http://www.vg163.com/map

                            //Registerhttp://localhost for local host development ofMaps API.

                            //MyKEY for local development is : (>>My google Maps API key>>My googlekey>>Google Key)

                            ABQIAAAAApbeFekOrHqlx0DRrS6KDBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSi6S-q_gEcFYw9i4J1dF9-OAURNA

                   3.LoadGoogle Maps API, like this: (>>Load Google Maps API>>Load Maps API>>howto load google map)

                            ##----HTML----##

                            <%@Page Language="C#" AutoEventWireup="true"CodeBehind="GM.aspx.cs" Inherits="RCS.GM" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

   <title></title>

    <script      src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAApbeFekOrHqlx0DRrS6KDBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSi6S-q_gEcFYw9i4J1dF9-OAURNA"type="text/javascript"></script>

    <script type="text/javascript">

                       function load() {

                           //检查浏览器的兼容性.(>>Check browser compatibility>>Check whichbrowser>>Google check browser)

                           if (GBrowserIsCompatible()) {

                               //加载地图

                               var map = newGMap2(document.getElementById("map_canvas"));//(>>Create googlemaps)

                               //设置地图的中心坐标.

                               map.setCenter(newGLatLng(39.990168, 116.295304), 15);//(>>Set google mapscenter>>Set maps center>>set google map center)

                                              

                                               //>>Setgoogle map type>>Set google Maps type>>Set Maps type>>Set maptype>>Google map type>>Google Maps type

                                               map.setMapType(G_SATELLITE_MAP);

//G_HYBRID_MAP, G_NORMAL_MAP

 

//>>Add control to googlemap>>Add google map type control to map

map.addControl(new GMapTypeControl());

                           }

                       }               

   </script>

</head>

         <bodyonload="load()" onunload="GUnload()">

                   <!-- 地图画板 -->

                   <divid="map_canvas" style="width:640px;height:680px"></div>

         </body>

</html>

 

---- >>Google Map listener----

       ---->>Remove Listener----(>>Remove google map listener>>Deletegoogle map listener>>Delete Listener)

       ##----JS----##//(>>Opengoogle map info window)

       varhandler=GEvent.addListener(marker,”click”,function(){

marker.openInfoWindowHTML(“<h1>This isa info window</h1>”);
});

              GEvent.removeListener(handler);

              //GEvent.clearListeners();//>>clearall google map listener>>clear all listeners

 

---- >>Google map Icon----(>>MapIcon)

       ---->>Add google map icon----(>>Add map icon)

       ##----JS----##

       <script       src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAApbeFekOrHqlx0DRrS6KDBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSi6S-q_gEcFYw9i4J1dF9-OAURNA"type="text/javascript"></script>

    <script type="text/javascript">

 

        functionload() {

            if(GBrowserIsCompatible()) {          

                varmap = new GMap2(document.getElementById("map_canvas"));        

                map.setCenter(newGLatLng(39.990168, 116.295304), 10);             

                map.addControl(new GSmallMapControl());               

                map.addControl(new GMapTypeControl());

                varicon = new GIcon();//(>>new google mapicon)

                icon.image = "http://imgrc.ph.126.net/CIuwtw_qhH7eZoQEBHOg1Q==/4225502350380367995.jpg";

                icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";        

                icon.iconSize = new GSize(12, 20);

                icon.shadowSize = new GSize(22, 20);

                icon.iconAnchor = new GPoint(6, 20);//( >>google map point)

                icon.infoWindowAnchor = new GPoint(5, 1);

                varpoint = new GLatLng(39.990168, 116.295304);

                map.addOverlay(new GMarker(point,icon));

            }

        }

</script>

##----HTML----##

         <body onload="load()"onunload="GUnload()">

                   <div id="map_canvas"style="width:1024px; height:768px"></div>

         </body>

 

 

 

---- >>Mark map----(>>mark Googlemap>>Google Marker>>Google map marker>>Map Marker)

       ---->>Google Map Marker event----

       [onClickEvent]

       ####----Example1----####

       ##----JS----##

           <script        src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAApbeFekOrHqlx0DRrS6KDBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSi6S-q_gEcFYw9i4J1dF9-OAURNA"type="text/javascript"></script>

    <script type="text/javascript">

        functionload() {

            if(GBrowserIsCompatible()) {

                varmap = new GMap2(document.getElementById("map_canvas"));

                map.setCenter(new GLatLng(39.990168, 116.295304), 10);

                map.addControl(new GSmallMapControl());

                map.addControl(new GMapTypeControl());

 

                varpoint = new GLatLng(39.990168, 116.295304);

 

                varmarker = new GMarker(point, { draggable: true });

                GEvent.addListener(marker,"click",function(){marker.openInfoWindowHtml("Test")});

//(>>Addgoogle map marker onclick event>>Add listenser to google map marker>>Googlemap onclick event>>add goolge map event>>goolge mapevent>>Google event>>add listener to google map>>GEvent>>addgoogle map listener)

                map.addOverlay(marker);

            }

        }     

   </script>

 

         ####---Example2----####

    <script   src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAApbeFekOrHqlx0DRrS6KDBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSi6S-q_gEcFYw9i4J1dF9-OAURNA"type="text/javascript"></script>

    <script type="text/javascript">

        function load() {

            if(GBrowserIsCompatible()) {

               var map = newGMap2(document.getElementById("map_canvas"));

               map.setCenter(new GLatLng(39.990168,116.295304), 10);

               map.addControl(new GSmallMapControl());

               map.addControl(new GMapTypeControl());

 

               var point = newGLatLng(39.990168, 116.295304);

               map.addOverlay(createMarkerWithEvent(point,"Hi."));//(>>addmarker to google map)

           }

        }

 

              //>>Creategoogle map marker by function>>JS function to create google mapmarker>>function to create google map marker

        function createMarkerWithEvent(point,msg) {

           var marker = newGMarker(point);

           GEvent.addListener(marker, "click",function () { marker.openInfoWindowHtml(msg);});

           return marker;

        }

   </script>

 

      

 

       --->>How to use Google marker----(>>How to mark google map)

       ####----Example1----####

    <script        src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAApbeFekOrHqlx0DRrS6KDBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSi6S-q_gEcFYw9i4J1dF9-OAURNA"type="text/javascript"></script>

    <script type="text/javascript">

        var map;

                       functionload() {

                           if(GBrowserIsCompatible()) {

                               map = newGMap2(document.getElementById("map_canvas"));

                               map.setCenter(new GLatLng(59.990168, 116.295304), 15);

 

                               map.addControl(new GMapTypeControl());

 

                               map.addControl(new GLargeMapControl());

 

                               map.enableContinuousZoom();

 

                               map.enableScrollWheelZoom();

 

                               varpoint = new GLatLng(59.990168, 116.295304);//(>>add google map point>>add mappoint>>add point>>New google map point>>add googlepoint>>new google point)

 

                               varmarker = new GMarker(point);//(>>add google map marker>>new google mapmarker>>add marker>>new marker)

                                           //var marker = newGMarker(point, {draggable:true});//( >>google map draggablemarker>>Draggable marker>>Draggable google map marker)

 

                               map.addOverlay(marker);               

                           }

                       }     

   </script>

 

---- >>move google map----(>>Movemap)

       ####----Example1----####

       Summary:

                     1.Movemap method included:

                            map.panTo();

                            map.panBy();

                            map.panDirection();

         ##----HTML & JS----##

<%@ Page Language="C#"AutoEventWireup="true"CodeBehind="GM.aspx.cs"Inherits="RCS.GM"%>

 

<!DOCTYPE html PUBLIC "-//W3C//DTDXHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

    <script        src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAApbeFekOrHqlx0DRrS6KDBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSi6S-q_gEcFYw9i4J1dF9-OAURNA"type="text/javascript"></script>

    <script type="text/javascript">

        var map;

                       functionload() {

                           if(GBrowserIsCompatible()) {

                               map = newGMap2(document.getElementById("map_canvas"));

                               map.setCenter(new GLatLng(39.990168, 116.295304), 15);

                               map.addControl(new GMapTypeControl());

                               map.addControl(new GLargeMapControl());//>>add google map zoomcontrol

                               map.enableContinuousZoom();

                               map.enableScrollWheelZoom();       

                           }

                       }

 

                       functionmapMoveByDirection(dx, dy) {

                           map.panDirection(dx, dy);

                       }

 

                       functionmapMoveBy() {

                           map.panBy(newGSize(200,30));//(>>Gsize)

                       }      

   </script>

</head>

         <body onload="load()"onunload="GUnload()">

                   <div id="map_canvas"style="width:1024px; height:768px"></div>

        <!-- 向西南移动-->

        <input type="button"value="西南移动" onclick="mapMoveByDirection(0.5,-0.3)" />

 

        <!-- 向西北移动200px,向北移动30px-->

        <input type="button"value="向西北移动" onclick="mapMoveBy()" />

         </body>

</html>

 

 

 

---- >>Google scalecontrol----(>>Scale control)

       GScaleControl

 

---- >>Thumbnail mapcontrol----(>>Google small map control>>Google thumbnail mapcontrol>>small map control)

       GOverviewMapControl

 

---- >>Google map type selectioncontrol----(>>map type selection control)

       GMapTypeControl

       GMenuMapTypeControl

       GHierarchicalMapTypeControl

 

---- >>Google map Zoom control----(>>addzoom tool to google map>>Google map zoom tool>>Google mapnavigation control>>Map navigation control>>Google navigationcontrol>>Zoom controls>>Map Control>>Google map control >>Google zoom control)

       [Controltype](>>Google map zoom control type>>Zoom control type)

              GLargeMapControl

              ­GSmallMapControl

              GSmallZoomControl

       [Defaultzoom tool] (>>Google map default zoom tool)

              map.setUIToDefault();//>>Setgoogle map default zoom tools

       [Zoomlevel] (>>Google map zoom level)

              map.getZoom();//(>>Getgoogle map zoom level)

 

---- >>Google map searchbar----(>>map search bar)

       ---->>Enable map search bar----(>>Enable google map searchbar>>Enable google bar)

              map.enableGoogleBar();

 

---- >>Google maps infowindow----(>>Map info windows>>Google map info windows)

       ---->>Enable Google Map info windows----(>>enable map info windows)

              map.enableInfoWindow();

       ---->>How to use Google map info window----

              ####----Exampe1(Withouttab)----####

              ##----JS----##

                  <script        src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAApbeFekOrHqlx0DRrS6KDBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSi6S-q_gEcFYw9i4J1dF9-OAURNA"type="text/javascript"></script>

    <script type="text/javascript">

        functionload() {

            if(GBrowserIsCompatible()) {//(>>Check google map browser compatibility)

                varmap = new GMap2(document.getElementById("map_canvas"));//(>>create googlemap map object)

                map.setCenter(new GLatLng(39.990168, 116.295304), 10);//(>>Setgoogle map center)

                map.addControl(new GSmallMapControl());//(>>Add control togoogle map)

                map.addControl(new GMapTypeControl());

                map.openInfoWindow(map.getCenter(),document.createTextNode("景元,你好"));

//(>>open google map info window>>Getgoogle map center)/

                                   //>>Createinfo window with HTML>>Create google map html info windows>>addgoogle map info window

                              map.openInfoWindowHtml(map.getCenter(),"图片是这样的:<br><imgheight='70px'src='http://lh4.ggpht.com/_PlzAWvG1JWE/R7qCtOtJ34I/AAAAAAAAACU/sXBf-rj07Q4/s128/IMGP7150.JPG'/><br><br>地址:广东省东莞市常平镇金美花园金泽台38A<br>电话:0769-83334125<br><br>")

            }

        }     

   </script>

         ####----Example2----####(>>Google map tab infowindow>>Google map paging info windows)

           <script        src="http://ditu.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAApbeFekOrHqlx0DRrS6KDBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSi6S-q_gEcFYw9i4J1dF9-OAURNA"type="text/javascript"></script>

    <script type="text/javascript">

        functionload() {

            if(GBrowserIsCompatible()) {

                varmap = new GMap2(document.getElementById("map_canvas"));

                map.setCenter(new GLatLng(39.990168, 116.295304), 10);

                map.addControl(newGSmallMapControl());

                map.addControl(new GMapTypeControl());

 

                ////(>>JSarray>>new js array>>create js array) 

                varinfoTabs = [

                                               new GInfoWindowTab("环境", "天坛公园很漂亮,祈年殿尤其不错.<b>Good</b>"),

                                               new GInfoWindowTab("饮食", "仅次于一般")

                                               ];

                varmarker = new GMarker(map.getCenter());

                GEvent.addListener(marker, "click", function() {

                   marker.openInfoWindowTabsHtml(infoTabs);

                });

 

                map.addOverlay(marker);

 

               marker.openInfoWindowTabsHtml(infoTabs);

   </script>

 

 

---- >>Drag GoogleMaps----(>>Grag maps)

       map.enableDragging();

 

---- >>Set Google Maps Zoom----( >>enable google map zoom>>enablegoogle zoom>>Set google map zoom>>Google map zoom>>ZoomMaps>>Zoom google maps)

       ##---JS----##

       map.enableContinuousZoom();//Makethe google map can be zoomed without disappear the old map until the new map isloaded.

       map.enableScrollWheelZoom();//Youcan use the wheel button in mouse to zoom the Google Maps

       map.enableDoubleClickZoom();//Doubleclick to make zoom for the Google maps.

        
>>Null
*DBNull:(>>DBNull>>Database Null value)
---->>Check Null Value----
 [C#] (>>C# check null>>.Net Check null)
    ##----Code----##
         if (i==null)//OR if(i.Equals(null))
        {
            string s ="f";
        }
    ##----Code2----##
        int? i;
        i=null;
        if(i.HasValue)
        {
        }
        //HasValue can Only be used when Thevariable is value type, and you define it as int? i;,but reference type likestring do not have the property HasValue.(>>Nullable int)

---->>About DBNull----
    1.DBNull is C# null value representing the DB null, you canuse Convert.IsDBNull to check if the return from DB is null or not, like this:
       Convert.IsDBNull(DR["Name"]);//(>>Check Null>>Check DBnull value)
---->>Pass null to DB----(>>Pass DBNull to DB>>Pass DBNull toSql server)
    ####----Example1----####
    ##----Code----##
              myCmd.Parameters.Add("@JYXMRQ", SqlDbType.DateTime, 8);
              if (ds.Tables[1].Rows[j][11].ToString() == "")
               {
                   // myCmd.Parameters["@JYXMRQ"].Value =System.DBNull.Value;    (
这个不行)
                   myCmd.Parameters["@JYXMRQ"].Value = Convert.DBNull;//(>>ConvertDBNull>>Convert.DBNull>>DB Null value)
               }
               else
               {
                   myCmd.Parameters["@JYXMRQ"].Value =ds.Tables[1].Rows[j][11].ToString();
               }

*Set Null value:(>>Set null value)

[C#]    

           if(M_IntCtrlID2==null)

           {

               M_Params[1].Value =DBNull.Value;//>>Set DBNullvalue>>Set DB null value

           }


*Check the null:(>>IsNull>>Check if Null)

[VB.Net]
    If IsNull(RS("Email_addr")) Then
        MsgBox "Email is Null"
    End If

[SQL] (>>SQL Null>>Check SQLNull>>Check SQL DBNull)

    selectIsNull(Sum(Product.Price*ShoppingChart.Quantity),0) from ShoppingChar innerjoin Product on ShoppingCart.ProductID=Product.ProductID whereShoppingCart.CartID=@CartID//IsNull will covert Null into 0.

 

*Select Null:(>>Select Null bySQL>>Check sql null)

Select ID from table1 where ID=110 and Nameis null //Must use "is null" to select null value Name field(If Namefield is null value), can not use "select ID from table1 where ID=110 andName=null" to get 


>>Oracle:

*Oracle Problem:(>>Oracle Problems)

      ----Problem1:----(Oracle错误- Ora-12514TNS:监听程序当前无法识别链接描述符中请求的服务。)

       Solution: Just enable the service named "OracleServiceOrcl" inservices.msc.    

   ----Problem2----(ORA-12154: TNS: 无法解析指定的连接标识符)  

       Situation: When using ASP.Net try to connect to Oracle, the above errorshown.

       Solution:       

 

*Oracle Doc:(>>OracleKnowledge>>Oracle Document>>Oracle data)

   H:/Jim57Data/DB/Oracle/Data/Oracle Data.pdf

 

*Oracle Table:(>>Oracle Table)

---->>Create Oracle Table----

DROP TABLE emptab; 

CREATE TABLE emptab (empno NUMBER(4) PRIMARYKEY, ename VARCHAR2(10));//(>>CreateOracle Table primary key>>Table Primary Key>>Oracle Table PrimaryKey)

INSERT INTO emptab VALUES ( 1, 'Mark');

INSERT INTO emptab VALUES ( 2, 'Roger');

INSERT INTO emptab VALUES ( 3, 'Crook');

COMMIT;

-

 

*Oracle storedprocedure:(>>>>oracle stored procedure>>Stored Procedure)

    ---->>Create Oraclestored procedure----(>>How to create oracle storedprocedure>>Create Stored Procedure)        

DROP TABLE depttab;//(>>Delete Table>>Delete OracleTable)

CREATE TABLE depttab (deptno NUMBER(2), dnameVARCHAR2(14));//(>>CreateTable>>Create Oracle Table)

CREATE OR REPLACE PROCEDURETest_Arraybind(pdeptno NUMBER,

                                         pdname VARCHAR2) IS  

BEGIN  

  INSERT INTO depttab (deptno,dname) VALUES ( pdeptno, pdname);  

  COMMIT;  //(>>Oracle beginend>>Oracle Commit)

END;


*Oracle Loop:(>>Oracle Loop>>Oracle for in>>forin>>loop>>For in loop>>Oracle for in loop)
    ####----Example1----####
    ##----Sql----##
    FOR Lcntr IN 1..20//(>>ORacle foreach)
    LOOP
         LCalc := Lcntr * 31;
    END LOOP;
This example will loop 20 times. The counter will start at 1 and end at 20.
    FOR Lcntr IN REVERSE 1..15
    LOOP
         LCalc := Lcntr * 31;
    END LOOP;
This example will loop 15 times. The counter will start at 15 and end at 1.(loops backwards)

*Oracle Join:(>>Oracle join>>Oracle left join>>Oracle rightjoin>>Left join>>right join)
    ####----Example1----####    
    1. SELECT * FROM T1,T2 WHERE T1.F1=T2.F2(+) //This is 
Left join, all record in T1 will be shown.
        select * from T1,T2 where T1.F1(+)=T2.F2//Right join, all record in T2 will be shown.
    2. SELECT * FROM T1 LEFT JOIN T2 ON T1.F1=T2.F2 //Only therecord both in T1 and T2 will be shown(>>
Inner join>>Oracleinner join)
    
当查看1的执行计划时发现T1为全表扫描,T2为索引扫描。
    
当查看2的执行计划时发现两个表均为全表扫描。//(>>Oracle summary)
    

*Oracle Summary:

    ----My Summary----

       1.Use Truncate Table (not Delete Table, Drop table) todelete table. see Info 1 for detail.

        2.Donot use Not in, for it is very slow,it will search for the eachrecord, use + to take the place of it.

    ----Info----

        Info 1.

 

*.Net use Oracle:(>>.Net useOralce>>.Net and Oracle>>How to use Oracle by .net>>How touse ODP.net>>ODP.net>>vs use odp.net>>use odp.net)

    ----Steps----

       1.Download ODP.net from here.

           //Or from my local laptop:  G:/Backup/Software/DataBase/Oracle/For.Net/ODP.Net/ODTwithODAC1110621.zip

           (>>Download odp.net>>DownloadODAC>>Install ODT)

       2.Download Oracle.(>>Download Oracle 11g)

           //Or from my laptop: G:/Backup/Software/DataBase/Oracle/DB/win32_11gR1_database_1013.zip

       3.Install Oracle,like this.(>>Install Oracle on windows XP)

        4.Addreference, like this:(>>Add ODP.netreference>>Reference ODP.net>>Refer to ODP.net>>odp.netnamespace>>odp.net reference)

               using Oracle.DataAccess.Client;//About data access class and enumerations.(C# reference ODP.net)

               usingOracle.DataAccess.Types; //Aboutthe type of ODP.net for both class and structure etc.

       5.Create connection string:(>>Create connections string>>Connectionstring>>Create ODP.Net Connection String>>create oracleconnection>>Oracle Connection String>>Oracle connection object)

           ##----Example1----##

           using (OracleConnection objConn = newOracleConnection("Data Source=ORCL; User ID=scott; Password=tiger"))            

{

               OracleCommand objCmd = new OracleCommand();

               objCmd.Connection = objConn;

               objCmd.CommandText ="human_resources.get_employee_department";//(>>Oracle use stored procedure>>UseStore Procedure)

               objCmd.CommandType = CommandType.StoredProcedure;

               objCmd.Parameters.Add("cur_employees",OracleType.Cursor).Direction = ParameterDirection.Output;

               objCmd.Parameters.Add("cur_departments",OracleType.Cursor).Direction = ParameterDirection.Output;//(>>Oracle Type>>Oraclecursor>>Oracle Output Parameter>>C# OutPut parameter)

 

               try

               {

                   objConn.Open();

                   OracleDataReader objReader =objCmd.ExecuteReader();

                   prvPrintReader(objReader);

                   objReader.NextResult();//>>DR next value>>DR next result

                   prvPrintReader(objReader);

               }

 

               catch (Exception ex)

               {

                   System.Console.WriteLine("Exception:{0}",ex.ToString());

               }

 

               objConn.Close();

}

##----Exxample2----##

string connectStr = "User Id=scott;Password=tiger; Data Source=orcl9i"; 

OracleConnection connection;

connection = newOracleConnection(connectStr);

connection.Open()

        5.Set Oracleconnection string at Web.config file, like this. //For ODP.net.(>>Oracleconnection string>>Set Oracle connection string)

        6.Writeconnection code by Oracle component, OracleDataAccess.dll, like this. (>>Connect toOracle Database)

    ----Remark----

       1.ODP.Net requires Oracle 9.2 or later if you want to use it in .Netenvironment.

    ----Example----(>>ODP.netExample)

        Example 1.

    ----Info----

        Info 1.



>>GridView:

*GridView Header: (>>Gridview header)

---- >>Frozen gridview header----(>>Frozenheader)

       ####----Example1----####

       ##----CSS----##

/* So the overflow scrolls */

.container {overflow:auto;}

 

/* Keep the header cellspositioned as we scroll */

.container table th {position:relative;}

 

/* For alignment of the scrollbar */

.container table tbody{overflow-x:hidden;}

##----HTML----##

       <div class="container" style="height:300px; width:200px;">

        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"

            AllowSorting="true" BorderWidth="0px">

            <Columns>

                <asp:BoundField HeaderText="ID" DataField="CustomerID" SortExpression="CustomerID" />

                <asp:BoundField HeaderText="Name" DataField="ContactName" SortExpression="ContactName" />

                <asp:BoundField HeaderText="Title" DataField="ContactTitle" SortExpression="ContactTitle" />

                <asp:BoundField HeaderText="Address" DataField="Address" SortExpression="Address" />

                <asp:BoundField HeaderText="City" DataField="City" SortExpression="City" />

            </Columns>

        </asp:GridView>

      </div>

 

 

*ASPxGridView:(>>ASPxGridView)

---->>How to use ASPxGridView----

        Info 1.
---->>Context Menu----(>>ASPxGridView right click>>Rightclick>>ASPxGridView Context Menu)
    ##----JS----##//It is just used when you right click theheader of field (>>HTML event>>ASPxGridView client sideevent>>Client side event)
    
<ClientSideEventsContextMenu="function(s, e) {
if(e.objectType == 'header') 
headerMenu.ShowAtPos(e.htmlEvent.clientX, e.htmlEvent.clientY);
}" />

 

*GridView Example:(>>GridViewExamples>>How to use GridView)

----Example----

    Example 1.

 

*GridView Template Item:(>>GridViewTemplate Items)

---->>GridView Edit Template----

       ----Example----

           Example 1.(>>GridViewItem Template>>GridView Default template)

 

*GridView Format:(>>GridView Format)

---->>GridView DataFormat----(>>GridView Field Format)

    ----Example----

        Example 1.

 

*GridView Confirm Event:(>>GridViewConfirm Event)

---->>How to use GridView ConfirmEvent----(>>GridView confirm delete event)

    ----Example----

        Example 1.(>>Confirm Event>>JS confirm event)

 

*GridView and CheckBox:(>>GridView andCheckBox)

-----Example----(>>GridView andCheckBox Example)

    Example 1.(>>Find GridView CheckBox Control>>Find Control>>GridViewFind Control>>How to use GridView CheckBox)

 

*GridView Paging:(>>GridViewPaging>>GridView Paging Event)

[ASP.Net]  (>>ASP.Net GridViewPaging Event)

    -----Example----

        Example 1.   

 

*GridView Bind Data:(>>GridView BindData>>Binddata)

---->>GridView Bound Fields----

[ASP.net] (>>BoundField>>BoundField>>SortExpression>>ReadOnly>>Read Only>>SortExpression)

    <ASP:GridViewID="ID" runat="server"AutoGenerateColumns="false">

       <Columns>

           <Asp:BoundField DataField="ProductID"HeaderText="My header" ReadOnly="True"SortExpression="ProductID"/>

       </Columns>

    </ASP:GridView>

---->>GridView Row BoundEvent----(>>gridview row bound>>gridview row bindingevent>>gridview row event)

[ASP.Net]

   ----Example----(>>How to use GridView Row Binding Event>>Howto use GridView Row bound event)

        Example 1.(>>Checkgridview row type>>Check gridview data row>>Set GridView Atrribute>>SetGridView Mouseover event>>GridView Mouseover event)

 

*GridViewFindControl:(>>FindControl>>GridView FindControl)

----Way 1----

    stringM_Str=((TextBox)GridView.Rows[e.RowIndex].FindControl("ControlID")).Text; 

----Way 2----

    ((TextBox)GridView.Rows[e.RowIndex].Cells[0].Controls[0]).Text;

 

*GridView DataKeys:(>>GridViewDataKeys>>GridView DataNames>>DataKeys>>GridView Keyname>>GridView Key Names>>GridView Data Keys Names>>GridViewDataKeyNames>>GridView Keyname>>GridView Key name>>Key field)

---->>Bind GridView KeyName-----    

    ----Example----

        Example 1.

----Template----

<Asp:GridView ID="MyID"runat="server" DataKeyNames="DepartmentID">//DepartmentID is the DataKeys

    //Some field

</Asp:GridView>

----How to use----(>>How to useGridView DataKeys>>How to use DataKeys>>Use GridView DataKeys)

stringM_Str=GridView.DataKeys[e.RowIndex].Value.ToString();

 

*GridView Navigation field:(>>GridViewNavigation Field>>GridView HyperLink field>>Hyperlink field)

<Asp:HyperLinkFieldDataNavigateUrlField="DepartmentID"DataNavigateUrlFormatString="../Page.aspx?DepartmentID={0}"Text="MyText"/> //Hyperlink field format

 

*GridView Row:(>>GridViewRow>>Gridviewrow)

---->>Get GridViewRow----(>>GetGridView Row>>Get TableCell)

    GridViewRowGVR=grid.Rows[rowIndex];

    TableCellTC=GVR.Cells[0];//Get the cell
---->>Add Row----(>>Add gridview row>>Insertrow>>Insert gridview row>>gridview add row)
    ####----Example1----####
    ##----HTML----##    

<asp:GridView ID="gvIngredient" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ProductIngredient_ID" DataSourceID="odsIngredient" ShowFooter="True" Width="792px" OnSelectedIndexChanged="gvIngredient_SelectedIndexChanged" OnRowCreated="gvIngredient_RowCreated">

    <Columns>

           <asp:TemplateField ShowHeader="False">

           <ItemTemplate>

               <asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False" CommandName="Edit” 
                Text="Edit" >asp:LinkButton <asp:LinkButton ID="lbDelete" runat="server"

                CausesValidation="False" CommandName="Delete" Text="Delete">asp:LinkButton>

           ItemTemplate>

           <EditItemTemplate>

                <asp:LinkButton ID="lbUpdate" runat="server" CausesValidation="True" CommandName="Update"

                Text="Update" >asp:LinkButton> <asp:LinkButton ID="lbCancel" runat="server" 

                CausesValidation="False" CommandName="Cancel" Text="Cancel">asp:LinkButton>

           EditItemTemplate>

            <FooterTemplate>

                <asp:LinkButton ID="lbInsert" runat="server" CommandName="Insert" ValidationGroup="addVal"
                       
 OnClick="lbInsert_Click">Insertasp:LinkButton> <asp:LinkButton ID="LinkButton2"
                       
 runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"
                       
 OnClick="LinkButton2_Click">asp:LinkButton>

            FooterTemplate>

        asp:TemplateField>

        <asp:TemplateField HeaderText="Ingredient" SortExpression="ProductIngredient_Name">

            <ItemTemplate>

    <asp:Label ID="Label1" runat="server" Text='<%#Bind("ProductIngredient_Name") %>' > //Bind data>>Bind Data to gridview field
           
asp:Label>

            ItemTemplate>

            <EditItemTemplate>

                <asp:TextBox ID="tbIngredient" runat="server" Text='<%#Bind("ProductIngredient_Name") %>'> 
                       
 asp:TextBox>

            EditItemTemplate>

            <FooterTemplate>

                <asp:TextBox ID="tbIngredient" runat="server" Text='<%#Bind("ProductIngredient_Name") %>'>

                       asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"

                ControlToValidate="tbIngredient" ErrorMessage="Enter aningredient" ValidationGroup="addVal">

                asp:RequiredFieldValidator>

            FooterTemplate>

        asp:TemplateField>

        <asp:TemplateField HeaderText="Stock" SortExpression="ProductIngredient_Stock">

            <ItemTemplate>

               <asp:Label ID="Label2" runat="server" Text='<%#Bind("ProductIngredient_Stock") %>'>asp:Label>

            ItemTemplate>

            <EditItemTemplate>

                <asp:TextBox ID="tbStock" runat="server" Text='<%#Bind("ProductIngredient_Stock") %>'

                Width="49px"> asp:TextBox>

            EditItemTemplate>

            <FooterTemplate>

                <asp:TextBox ID="tbStock" runat="server" Text='<%#Bind("ProductIngredient_Stock") %>'

                Width="49px">asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2"

                runat="server" ControlToValidate="tbStock" ErrorMessage="Enter astocklevel"

                ValidationGroup="addVal">asp:RequiredFieldValidator>

            FooterTemplate>

        asp:TemplateField>

        <asp:TemplateField HeaderText="Minimum stock" SortExpression="ProductIngredient_MinStock">

            <ItemTemplate>

                <asp:Label ID="Label3" runat="server" Text='<%#Bind("ProductIngredient_MinStock") %>'>

                asp:Label>

            ItemTemplate>

            <EditItemTemplate>

               <asp:TextBox ID="MinStock" runat="server" Text='<%#Bind("ProductIngredient_MinStock") %>'

                Width="56px">asp:TextBox>

            EditItemTemplate>

            <FooterTemplate>//(>>Footer Template>>Gridview Footer Template)

                <asp:TextBox ID="tbMinStock" runat="server" Text='<%#Bind("ProductIngredient_MinStock") %>'

                Width="56px">asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator3"

                runat="server" ControlToValidate="tbMinStock" ErrorMessage="Enter a minimumstock"

                ValidationGroup="addVal">asp:RequiredFieldValidator>

            FooterTemplate>

        asp:TemplateField>
    Columns>

asp:GridView>

<asp:ObjectDataSource ID="odsIngredient" runat="server" DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetData" TypeName="SMAP.Datalogic.dsSMAPTableAdapters.ProductIngredientTableAdapter" UpdateMethod="Update" OnDeleting="odsIngredient_Deleting" OnInserting="odsIngredient_Inserting">

            <DeleteParameters>

                   <asp:Parameter Name="ProductIngredient_Deleted" Type="Boolean" />

                   <asp:Parameter Name="Original_ProductIngredient_ID" />

            DeleteParameters>

            <UpdateParameters>

                   <asp:Parameter Name="ProductIngredient_Name" Type="String" />

                   <asp:Parameter Name="ProductIngredient_Stock" Type="Double" />

                   <asp:Parameter Name="ProductIngredient_MinStock" Type="Double" />

                   <asp:Parameter Name="Original_ProductIngredient_ID" />

            UpdateParameters>

            <SelectParameters>

                   <asp:ControlParameter ControlID="cbDeleted" Name="ProductIngredient_Deleted"

                    PropertyName="Checked" Type="Boolean" />

            SelectParameters>

            <InsertParameters>

                    <asp:Parameter Name="ProductIngredient_Name" Type="String" />

                    <asp:Parameter Name="ProductIngredient_Stock" Type="Double" />

                    <asp:Parameter Name="ProductIngredient_MinStock" Type="Double" />

            InsertParameters>

asp:ObjectDataSource>

    ##----Code----

    protected void lbInsert_Click(object sender, EventArgs e)

   {

     odsIngredient.Insert();

   }

   protected void LinkButton2_Click(object sender, EventArgs e)

   {

      ((TextBox)gvIngredient.FooterRow.FindControl("tbIngredient")).Text = "";

      ((TextBox)gvIngredient.FooterRow.FindControl("tbStock")).Text = "";

      ((TextBox)gvIngredient.FooterRow.FindControl("tbMinStock")).Text = "";

   }

   protected void odsIngredient_Inserting(object sender, ObjectDataSourceMethodEventArgs e)

   {

      string Ingredient = ((TextBox)gvIngredient.FooterRow.FindControl("tbIngredient")).Text;//(>>Find control>>GridView find control>>FooterRow>>Gridview Footer row)

      string stock = ((TextBox)gvIngredient.FooterRow.FindControl("tbStock")).Text;

      string minstock = ((TextBox)gvIngredient.FooterRow.FindControl("tbMinStock")).Text;

     e.InputParameters["ProductIngredient_Name"] = Ingredient;

     e.InputParameters["ProductIngredient_Stock"] = stock;

     e.InputParameters["ProductIngredient_MinStock"] = minstock;

   }

 

 

*Edit GridView Row:(>>Edit GridViewRow>>Gridview edit row)

http://jims57.blog.163.com/blog/static/95136172010217115324682/

 

*Cancel edit GridView(>>Cancel EditGridView Row)

http://jims57.blog.163.com/blog/static/95136172010217115522935/

 

*Update GridView Row(>>Update GridViewRow>>Gridview update Row Event>>GridView Row Update Event)

[C# WinForm]

http://jims57.blog.163.com/blog/static/95136172010217115850189/  (>>GridViewDataKeysd>>DataKeys>>RowIndex>>EditIndex)

[ASP.Net]

    ----Example----

        Example 1.

 

*Delete GridView Row(>>Delete GridViewRow>>gridview delete row>>GridView Delete Row Event)

[C# WinForm]

http://jims57.blog.163.com/blog/static/95136172010218014799/ (>>EditIndex>>DataKeys>>RowIndex>>RowIndex)

[ASP.Net] (>>ASP.net GridView DeleteRow Event)

    ----Example----

        Example 1.   (>>GridView Data Keys>>GridView Keys Value)


>>DataGridView:

*DataGridView Row:(>>DataGridView Rows)

---->>Add DataGridView row----

    ----Example----

        Example 1.(>>Add datagridview row by string array)

 

*DataGridView Row Index:(>>DataGridViewRow Index)

---->>DataGridView Current RowIndex----

        int i =dataGridView1.CurrentRow.Index;

 

*Add DataGridView Cell ToolTips(>>AddDataGridView Cell ToolTips>>DGV cell tip>>DGV CellTooltips>>Add DGV Cell Tooltips)

this.DataGridView[2,2].ToolTipText="I amthe tool tip for the cell";

 

*DataGridView Event:(>>DataGridViewClick cell Event>>DataGridView cell Select event>>datagridview cellclick event):

 

private void dataGridView1_CellClick(objectsender,    DataGridViewCellEventArgs e)

{

----Content----
}

 

*DataGridView Selection Cellevent(>>DataGridView select change event>>DataGridView selectionchanged event):

this.DgvCaseList.SelectionChanged+=newEventHandler(DgvCaseList_SelectionChanged);//Add in form load

private voidDgvCaseList_SelectionChanged(object sender, EventArgs e)

.{

----Action-----
}

 

*DataGridView Cell Double Clickevent(>>Datagridview double click cell event>>DataGridView Doubleclick event>>DataGridView Cell Double click event)

this.DgvCaseList.CellDoubleClick+=newDataGridViewCellEventHandler(DgvCaseList_CellDoubleClick);

private voidDgvCaseList_CellDoubleClick(object sender, DataGridViewCellEventArgs e)

{

----Action-----
}

 

*Set the row color ofDataGridView(>>Set DataGridView Row color>>DataGridView RowColor>>DataGridView and Row):

DataGridView.Rows[I].DefaultCellStyle.BackColor=System.Drawing.Color.AliceBlue; //I is the row index you are going to setcolor

 

*Decide the row is notheader(>>DataGridView valid row>>DataGridView null):

if(this.DgvCaseList.CurrentRow != null)

{
}


*Scroll the DataGridView(>>FirstDisplayedScrollingRowIndex>>ScrollDataGridView):
this.VsbCaseList.Maximum =this.DgvCaseList.RowCount;          
this.DgvCaseList.FirstDisplayedScrollingRowIndex = this.VsbCaseList.Value;





>>Controlss:

*Customized control:(>>Customizedcontrol)

---->>Make customized controls----(>>Registercustomized controls)

[.Net]

   ##----Example(Website)----##

        Example 1.

---->>Register Customizedcontrols----(>>Register controls)

[ASP.Net]

    ##----Example----##

        Example 1.

---->>Add Customized controlIcon----(>>Add control icon)    

 

*Load Control:(>>LoadControl>>Load UC>>Load User controls)

[ASP.Net](>>ASP.Net load user control)

    Controlc=Page.LoadControl(Request.ApplicationPath+"/Aspfile.ascx");

   ContentPlaceHolder.Controls.Add(c);

 

>>Stored Procedure:

*Stored Procedure Type:(>>Storedprocedure type)

---->>Set Stored Procedure type----

   SqlCommand.CommandType=CommandType.StoredProcedure;// >>CommandType>>CommandType

 

*How to use store procedure(>>How touse store procedure>>How to use stored procedure):

[C#]

----Example 1----

http://jims57.blog.163.com/blog/static/951361720091012093574/edit/?mode=prev 

[Oracle] (>>how to use oracle storedprocedure)

    ##----SQL----##

        ----Example1----(>>Set Oracle variablevalues>>Oracle Exception>>Oracle error>>Get oracle errorinfo>>Set oracle variable value by select sentences)

 

*Execute Stored procedure in StoredProcedure:(>>Exec SQL stored procedure>>Exec SQL storedprocedure>>sql exec>>Execute Stored procedure in StoredProcedure>>Exec Stored Procedure>>Set variable by storedprocedure>>Set variables by stored procedure)

http://jims57.blog.163.com/blog/static/95136172009112595446906/edit/?mode=prev

http://jims57.blog.163.com/blog/static/9513617201022805433955/  //>>GetDate()>>GetCurrent DateTime>>Execute SQL stored procedure

 

>>Row:

*Row Values:(>>Row Values)

---->>Get Row Values----

    [ASP.Net]

   ---->>ASPxGridView----(>>Get ASPxGridView Row Values)

        ----Example1----(>>Get Row>>Get ASPxGridViewSelected Rows)

        ----Example2----(>>Row event to get row values>>Getrow values by row event)

 

*Row Event:(>>Row Event)

---->>Change Row Event----(>>Rowchange event)

    [ASP.Net]

       ----ASPxGridView----(>>ASPxGridView row change event>>3 partygridview row change event)

           Example 1.

 

*Delete Rows:(>>Delete Rows>>Rowdelete)

[Javascript](>>Delele table row by javascript)   

---->>Delete duplicate row----

    [Oracle] (>>DeleteOracle duplicate row records)

        ----Example1----(>>Oracle loop>>oraclewhile>>Oracle covert to char>>Oracle Output>>Create Oraclestored procedure>>Oracle if else>>Oracle check find ornot>>Oracle row count)

 

*Add rows:(>>Add rows)

[Javascript] (>>Add table row by javascript)   

 

>>Hide:

*Hide Field:(>>Hide Fields)

[ASP.Net]

   ----ASPxGridView----(>>Hide ASPxGridView Fields)

        ----Example1----    

 

>>VSS:(>>Visual SourceSafe)

*How to use VSS:(>>How to use VSS)

    ----Steps----

       1.Download VSS from here.

           Or my laptop: (>>Download VSS>>Download VisualSourceSafe)

       2.Install and configurate VSS, like this.//Info2.Info 3.(>>Install VSS>Configure VSS)       

 

>>ExtJS:

*ExtJS website:(>>ExtJSWebsite>>ExtJS>>ExtJS study website)

 Link 1:www.Extjs.com //Official website

 Link 2:http://www.ajaxjs.com/ //Chineseversion (>>ExtJS study>>Study ExtJS)

 

>>Authorization:

*How to use authorization:(>>How to useauthorization)

----Summary----(>>Authorizationsummary)

    1.If you want to specifywhich folder or page the user can not access, just add the node <location> outsidethe <authorization>, like this.

 

>>Web.Config:

*Web.Config Summary:(>>Web.configsummary)

    Summary 1.

 

*Web.Config Namespace:(>>Web.confignamespace)

System.Configuration.ConfigurationManager;

 

*AppSetting Value:(>>AppSettingsValue>>AppSetting value)

---->>Get AppSettingsvalues----(>>Get Appsetting values)

[ASP.Net]

   ConfigurationSettings.AppSettings["ConnectionString"];

 

*Save Variable in Web.Config:(>>SaveVariable in Web.config>>Variable in Web.Config>>AppSettingsVariables)

[C#]

http://blog.163.com/jims57/blog/static/95136172010215101812158 //>>ConfigurationManager>>ConfigurationManager  

 

*Set page access right:(>>user accessright>>user right>>Set page access right>>Allow pageaccess>>Deny page access>Allow access>Deny access>>Deny Useraccess>>Allow User access)

[ASP.net]

    ----Info----

    Info 1.(>>Web.Config Authorizationconfiguration>>Authorization>>deny user access page>>Denyuser access specific page)

    Info 2.(>>Web.Config Authentication Configuration)

    Info 3.(>>Deny userto access path>>Deny user to access specific folder>>Deny user toaccess folder>>Authorization node usage>>Use web.configauthorization).

 

>>UML:

*How to use UML:(>>How to use UML)

---->>What is UML----

    Info 1.(>>UML structure)

 

>>Software Engineering:

*Software ProjectManagement:(>>Software Project Management>>SoftwareManagement>>Software Management)

----Study----(>>Software ProjectManagement Info>>Software Engineering Study)

    Info 1.

---->>Steps----

    1.

---->>Software engineeringtools----(>>Project management tools>>Software management tools)

    1.Rose (CaseTool): For Requirement Analysis and Design phrase

    2.MS SourceSafe:For Coding Version Control.

    3.S-Design(Or PowerDesigner,PowerBuilder,BusinessObject): For DB creation.

    4.Project 2007: ForProject Following Tool.

    5.HTML Help Workshop(hhw.exe):For Help Document.

    6.SCCS: It isControl System to modify source code.

    7.MRCS: Controlsystem to modify requirement.

---->>Software Development Process----

    [WaterfallModel](>>Waterfall model)

       ----Picture----    

           Pic 1.

---->>Software Management Summary----

    1.Consider the softwareintegrally, do not just focus on the coding.

    2.Consider the problem atuser's view, user is the god of software.

    3.Com+ is better than.Dll.

    4.B/S is better than C/S.

    5.Take note whiledeveloping the sotware, note for good idea or hard problem.

 

>>HttpHandler:(>>HttpModule)

*Difference between HttpHandler andHttpModule:(>>Difference between HttpHandler and HttpModule)

    ----Summary----

        1.ActionorderHttpModule first, HttpHandler later.//If depends on the event, for soem events, the HttpModule willaction later.

        2.HandleFile TypeHttpModule will handle all file type, but HttpHandler willonly handle the file registered before, like aspx, asmx etc.

        3.HandleContentHttpHandler will create the response content byyour request, but HttpModule will do other, like pre-handle,validation(It also can handle the request content like HttpHandler can do.) //You can see the Chart to know detail.(>>Relation between HttpHandlerand HttpModule)

        4.HttpModule:用于页面处理前和处理后的一些事件的处理HttpHandler:进行真正的页面的处理

    ----Info----

        Info 1.

 

*How to use HttpHandler:(>>How to useHttpHandler)

----Steps----(>>Use HttpHandler Steps>>Stepsto use HttpHandler>>Step to use HttpHandler)

        Info 1. (>>Class inherited from IHttpHandler)

 

>>Generic:

*How to use Generic Type:(>>How to useGeneric Type)

----Summary----(>>Generic TypeSummary>>Generic Summary)

    1.You have to add thenamespace before you can use GenericusingSystem.Collections.Generic; (>>Generic Namespace)

    2.ArrayList Generictype is: List<T>. (>>ArrayList Generic Type>>List<T>>>C#vector>>Vector)

----Example----

    My Example 1.

 

*ArrayList Generic Type:(>>ArrayListGeneric Type>>List<T>)

---->>New List<T>----(>>NewArrayList generic type)

    List<string> L = newList<string>();//List<int> myList=new List<int>();

---->>How to uselist<t>----(>>How to use ArrayList generic type)

    ----Example----

        Example 1.

        Example 2.(>>Find List<T> object>>FindArrayList Gener Type child objects)

 

>>Internal:(>>Internal key word)

*What is internal:(>>What is internalkey word)

[C#] (>>C# internal key word)

    ----Info----

        Info 1.

 

>>Timeout:

*setTimeout:(>>SetTimeout>>Settimeout>>Delay action>>Delay function>>Delay function to act)

[JS](>>JS settimeout>>Javascriptsettimeout)

----Example----

    Example 1.

 

>>Across language:

*.Net and Java:(>>.Net and java>>Javaans .Net)

---->>.Net use Javafunctions----(>>C# use java functions)

    ----Info----

        Info 1.

 

>>Try catch:

*How to use try catch:(>>How to use trycatch)

[JS](>>How to use js trycatch)(>>JS try catch)

    ----Example----

        Example1.

 

>>Calendar:

*Calendar Control:(>>Calendar Controls)

[Javascript]

---->>JS Calendarcontrol----(>>Javascript calendar controls>>JS calendar controls)

    Info 1. (>>Download js calendarcontrol>>Download Javascript calendar control)

 

>>DataBase:(>>DB>>DataAcess)

*DB Tool:(>>DB Tools>>DataBaseTools)

[ODP.net](>>ODP.net)

    ---->>What isOdp.net----

          ODP.NET ORACLE公司为.NET开发者发布的一个 .NET 使用 ORACLE 数据库的类库 

 

*DB Class:(>>DB Class>>DB accessclass>>Database access class>>DB Framework>>Databaseframework)

[Data Access Application Block] (>>DataAccess Application Block)

----->>What is Data Access ApplicationBlock----

    Info 1.    

 

>>Exam:(>>Examination)

*Job Interview Exam:(>>InterviewExamination>>Job Interview Examination>>C# Examination>>.NetExamination)

    ----Info----

        Info 1.

        Info 2.

 

>>3 Tier Structure:(>>3 tiersStructures)

*ObjectDataSource:(>>ObjectDataSource 3tier structure>>Object Data Source Control)

----Summary----

    1.You have to createthe App_Code and then set up the class in it before you canuse the ObjectDataSource to access the data, like this.

    2.You have to create theclass the ObjectDataSource can access to in the App_Code folder,like this.

----Steps----

    File 1.

 

>>TreeView:

*How to use TreeView:(>>How to useTreeView)

[C#] (>>How to use C#TreeView>>C# treeview)

    ----MyExample----(>>TreeView Examples>>My TreeView Examples)

        Example 1.(>>Check if selecting thenode>>Check TreeView selection)

        Example 2.(>>Set TreeView ImageList>>SetTreeView Icons>>TreeView Icons>>How to use ImageList>>UseImageList>>Image from file)

 

*TreeView Events:(>>TreeView Events)

---->>TreeView Select node events----

    Example 1.

 

>>MVC:

*How to use MVC:(>>How to use MVC)

 

>>Base:

*How to use base:(>>How to use base)

[C#] (>>C# base key words)

    ----Example----

        Example 1.

        Example 2.

 

>>Virtual:

---->>How to use Virtual----

[C#] (>>How to use C# Virtual>>C#virtual)

    ----Summary----(>>C#virtual summary>>Virtual summary>>Virtual class summary)

        1.Virtual functioncan be instantiated, like this.

       2.When override the function in father class, you shoulddo like this.

        3.Virtual qualifiercan not be used with privatestaticabstract and override atthe same time, public is available.

        4.Youcan "override" the function in father class by new not override,like this.(>>Override father function by new)

        5.Virtual functioncan be in the normal class.

        6.Virtual cannotbe used with class, virtual class is wrong.

        7.Virtual functionhave to have the function body {},even you do not achieve thevirtual function, like this.

        8.Youcan either use Override or new to overridethe virtual function in father class, like this.

        9.Thereare no order for so-called public,virtual,abstract,you can use as public virtual, or virtual public etc.

    ----Example----(>>C#Virtual examples)

        Example 1.

>>Lock:(>>Lock key words)

---->>How to use Lock key words----

[C#] (>>C# lock key words)

   ----Summary----(>>Lock summary>>C# Lock summary)

    1.A thread is using aobject at the same time.(Can not have more than 1 thread using the same objector value.)

    2.If lock the currentclass object, just use lock(this){}, like this.(>>How to use lock this>>Lock(this)>>Lock current classobject)

    ----Example----

        Example 1.

 

>>Volatile:(>>Volatile key words)

---->>How to usevolatile----(>>what is volatile key words)

[C#] (>>C# Volatile key words)

    ----Example----

        Example 1. (>>Synchronized>>across threadaccess)

 

>>Singleton:(>>One instanceclass>>Only one instance class>>Singleton design pattern)

---->>How to use singleton----

[C#] (>>C# Singleton>>.NetSingleton>>C# one instance class>>>>how to use c#singleton>>how to use c# singleton)

    ----Summary----

       1.[Static method] You have to sealed the class,like this.

       2.[Static method] You have to set the constructor ofclass as private, and use {}, like this.

       3.[Static method] You have to use private static readonly todefine the memeber, like this.

    ----Example----(>>C#Singleton Example)

        Example 1.    

    ----My Example----

        My Example 1.

 

>>Params:

*Params Key word:(>>Params key words)

---->>How to use params----

[C#]

    ----Example----

    Example 1.

    Example 2.    

 

>>Linq:

*Linq to SQL:(>>Linq to SQL entity)

---->>How to use Linq to SQL----

[CreateLinq to SQL entity] (>>Linq toSQL steps>>Create Linq to SQL Entity)

    ----Info----

    File 1.(Or at 163 net disk: //PCInfo/How to use Linq toSQL.doc)

[QueryDataContext Entity](>>QueryLinq to SQL Entity>>Linq Search>>Linq query>>How to use Linqto SQL to query data)

    ----Example----

    Example 1. (>>Linq format>>Linq queryformat>>How to use Linq)

[ModifyLinq to SQL entity]

    ----Example----

    Example 2. (>>Modify Linq data)

 

>>SQL:

*SQL Summary:(>>SQL Summary)

    1.When you nest anotherSQL sentence, you should set the another SQL sentence alias, like this.

    2.Order by fieldname should not be appearred in the sub-SQL sentence, like this.

    3.When you set the aliasfor a specific field, you can not just use number as alias, when you want touse the number as alias, you should add '', like this.

 

*Inner Join:(>>Inner Join>>RightJoin>>Left Join>>Cross Join)

---->>What is Inner Join----

    Info 1.

 

*Optimize SQL Sentence:(>>Improve SQLSentence>>Optimize SQL Sentence)

----Tool----

    Software: LECCO SQLExpert

    Info: Info1(>>How to use LECCO SQL Expert)

----Summary----(>>SQL Optimizationsummary>>Improve SQL summary)

    1.Do not use "Select*"

 

*How to use Case When(>>How to use CaseWhen>>SQL Case When>>Case When>>SQL Case>>SQLIf else>>when case>>SQL when case):

[SQL]

----Way 1----

select 

    case

        whenname='jim' then 'J'

        whenname='Mark' then 'M'

        else'Other'

    end 

from tb_Test

----Way 2----    

select 

    case name

        when'jim' then 'J'

        when'Mark' then 'M'

        else'Other'

    end 

from tb_Test

----Way 3----

    Like this.

----Info----

    Info 1

 

*@@Identity:(>>@@Identity>>NewID>>New created ID>>Get new ID>>Get new created ID)

----Remark----

    The @@Identity is the newID after just using insert into table(Name) values(@Name)

----How to set----

    [SQL]

    Declare @ProductID int //>>Define SQL Variables>>Define Variables

    Select@ProductID=@@Identity//Set SQL Variables or use "Set@ProduectID=@@Identity" to set >>Set Variables       

 

*Inner Join:(>>InnerJoin>>Join>>How to use Join>>How to use inner Join)

Select Table1.ID, Name,Table2.Des from table1inner join table2 on where table1.ID=table2.ID

 

*Not in(>>Not in>>SQL Not In):

select * from aa where id not in(select idfrom bb)

 

*SQL Insert into format(>>SQL Insertformat>>SQL Insert into format):

insert into table1(Name) values(@Name)

 

*SQL Variables(>>Sql variables):

----Remark----(>>sql inputvariable>>income sql variables>>Input variables>>input sqlvariables)

Input Variables can be less than the setvariables in SQL sentence (Just use NULL), but it can not more than. 

Order of inputting variables can be differentfrom the SQL variables

----Example----

http://jims57.blog.163.com/blog/static/951361720091026525782/ (>>DefineSQL variables)

 

*SQL Boolean(>>SQL Boolean>>SQLtrue and false>>SQL bit)

For SQL sentence, the value is 1 or 0

For DB table,use true or false to set

For setting value, use "true" or"false" to set the value

 

*Set SQL Variables(>>Set SQLVariables):

Declare @Var Varchar(20) //>>Define SQLvariables

Set @Var='123'

 

*SQL Null(>>SQL Null>>How to useSQL Null>>Select SQL Null>>Null>>DB null):

select * from table1 where name is null

 

*SQL Case Sensitive:(>>SQL CaseSensitive)

----Remark----

In SQL sentence, there is not Case Sensitivein inquiry sentence.Like select * from table1 where Name='JIM'(orName='jim')[The same]

 

[Update] (>>SQL Update)

*Update the multi rows at the sametime(>>Update multi rows>>Update Multi-rows>>Update Many rowsat the same times>>SQL Update multi rows>>SQL UpdateMulti-rows>>SQL Update Many rows):

----Way 1----

update tb_Test3 set [Sum]=T2.S fromtb_Test3,(select TYPE,YEAR(Date) Y,SUM(Price) S from tb_Test2 group byType,Year(Date)) T2 where year(tb_Test3.Y)=T2.Y and tb_Test3.[Type]=T2.[Type]

//Sum field is the field which need to beupdated.

----Way 2----(>>Update many differentrows at the same time>>Update at the same time)

http://jims57.blog.163.com/blog/static/95136172009101281434390/edit/?mode=prev

 

*Set SQL variable value(>>Set SQLVariable Value):

Select @OldCount=[COUNT] from tb2_SupportInfo


*SQL Sentence:
[C#]
SQL server: string StrSQL=Select [Name] from [Form1];

*Read the sheet in a excel(>>Read Excel):
StrCon = "select * from [sheet2$] where Price>20" 

 

>>Error:

*Check errors:(>>Checkerror>>Check error status)

[SQL] (>>Check SQL Errors>>CheckSQL error status)

----Example----

    Example 1.(>>@@Error>>SQL Error>>SQL@@Error)

 

*Custom Errors:(>>CustomErrors>>Customized Error)

---->>Custom ErrorPage----(>>Customized error page)

[ASP.Net]

    ##----Web.config----##

        Example 1

>>JSON:(Javascript Object Notation)

*JSon Convertion: (>>Json Convertion)

       [C#](>>Convert C# object to json>>Convert c# to json)

               public class Employee

{

    public string Name { get; set; }

    public string Age { get; set; }

    public string ID { get; set; }  

}

 

Adding some instances of them to a List:

Employee oEmployee1 =

       new Employee{Name="Pini",ID="111", Age="30"};

 

Employee oEmployee2 =

      new Employee { Name = "Yaniv", ID = "Cohen", Age = "31" };

Employee oEmployee3 =

       new Employee { Name = "Yoni", ID = "Biton", Age = "20"};

 

//(>>New List)

List<Employee> oList = new List<Employee>()

{ oEmployee1, oEmployee2, oEmployee3 };

 

Serializing then:

System.Web.Script.Serialization.JavaScriptSerializer oSerializer =

        new System.Web.Script.Serialization.JavaScriptSerializer();

string sJSON = oSerializer.Serialize(oList);

And here is the output://(>>Json format)

[{"Name":"Pini","Age":"30","ID":"111"},

{"Name":"Yaniv","Age":"31","ID":"Cohen"},

{"Name":"Yoni","Age":"20","ID":"Biton"}]

             

 

*JSON Format:(>>JSON format)

       ####----Exampl----####

       ##----JSon----##

       {"Maths" : [ {"Name"    : "Minal",        //First element

                            "Marks"     : 84,

                            "age"       : 23 },

                             {

                            "Name"      :"Santosh",    // Second element

                            "Marks"     : 91,

                            "age"       : 24 }

                           ],                      

             "Science" :  [

                             {

                            "Name"      :"Sahoo",     // First Element

                             "Marks"     : 74,

                            "age"       : 27 },

                             {                                            

                            "Name"      :"Santosh",    // Second Element

                            "Marks"     : 78,

                             "age"       : 41 }

                           ]

                }

    Format 1. //Compare XML with JSON.

    Format 2.

 

*How to use JSON:(>>How to use JSON)

----Summary----

    1.JSON is Case-Sensitive.

    2.You have to use"eval("("+JSON_text+")");" format to change thestring in JSON_text variable into JSON, see Example 1.

    3.For array in JSON, itwill use "[]" to include the items of array, see format 2.

    4.JSON basic formatis: "Name":"Jim", use "" to mark item and value, use : todivide the item and value, use , toseparate to another item and value.

----Example----

    Example 1. (>>JS Eval()>>Get JSONdata>>Change string into JSON)

 

>>Cell:

*New Cell:(>>New Cell>>InsertCell)

[JS] (>>Insert JS newCell>>Insert js cell>>Add JS cell>>Add javascript cell)

    varoTr=document.getElementById("TableID").insertRow(2); //Index begin as0

    var oTd=oTr.insertCell(0);//insert the cell as the first cell into the oTr.       

 

>>Convert:

*Convert Row to Column:(>>Row toColumn>>Convert Row to column>>Change row to column>>exchangerow and column)

[SQL] (>>SQL row to column)

---->>SQL Row to column summary----

    1.Have to use Max().

    2.Have to use Group By,see following example 1.

    3.For Dynamic method: Haveto use as A, like example2.

    4.Have to use the alias,like AA, BB. See example 3.

    5.Field name which havebeen grouped by  must to appear, like My Example 1.

---->>SQL Row to column Examples----

    [SQL 2000]

    Example 1.    //Static method (>>SQLcase when end)

    Example 2.    //Dynamic method(>>Build sql string>>Exec sql>>SQL Case whenend>>Define sql variables>>Set sql variable)

    [SQL 2005]

    Example 3.  //2005 staticmethod(>>Pivot>>SQL pivot)

----My Example----

    My Example 1.

 

>>Division:

*SQL Division:(>>SQL Division)

8/4=2 //return 2

9/4=2.25 //return 2

11/4=2.75 //return 2

 

>>Prototype:

[JS] (>>Javascript prototype>>JSprototype):

*JS prototype:(>>JSprototype>>Javascript Prototype>>Prototype>>JSOOP>>Javascript OOP)

       ####----Exampe1----##

       ##----JS----##(>>Howto use js prototype>>How to use prototype)

function User(name,age){

this.name=name;

this.age=age;
}

            

              User.prototype.getName=function()

{

       Returnthis.name;

};

 

----My Example----(>>My JS prototypeexamples>>JS prototype examples)

    My Example 1.

    My Example 2. 

----Example----

    Example 1.

    Example 2.

----Summary----(>>JS prototypesummary>>Javascript prototype summary)

    1.Prototype inJS can be viewed as Base (father class) in C#.

    2.function people() { } canbe viewed as the constructor in C#.

    3.Father class and childclass is the same structure, just child has a difference at ChinesePeople.prototype= new people();

    4.You can either to change the prototypeby ChinesePeople.prototype = new people(); or not.(If not, childclass will use the father property, use its prototype)

    5.Every properties orfunction show has the prototype keyword, like this.

[C#]

----Example----

    Example 3.

 

*Floating DIV:(>>FloatingDiv>>Float Div>>Float Window>>Floating Windows>>Pop upwindows>>Pop up layer)

[Javascript]

http://jims57.blog.163.com/blog/static/95136172010283127154/

http://jims57.blog.163.com/blog/static/951361720102835231428/edit/

http://jims57.blog.163.com/blog/static/951361720102831617339/

[jQuery]

    http://jims57.blog.163.com/blog/static/9513617201022073955589/

    http://leotheme.cn/wp-content/uploads/Example/js/tipswindown

 

>>Class:

*Javascript Class:(>>JSClass>>Javascript class)

---->>JS ClassExample----(>>Javascript Class example)

    Example 1.

 

>>Design Mode:(>>DesignPattern>>Design Method)

*What is Design Mode:(>>What is DesignMode>>Design Mode explanation)

----Info----

    Info 1.

 

*Factory Design Mode:(>>Factory DesignMode>>Factory design method>>Factory Design pattern)

[Factorymethod mode]

----Summary----(>>Factory DesignPattern summary)

    1.The abstracted functionin interface do not need the public qualifier,like "void CPU();"(without public),see Info 1.

----Example----(>>Factory design modeexample)

    Example 1. (>>How to use factory designpattern>>how to use factory mode>>Factory mode>>Factorypattern)

----Info----

    Info 1.

[Simplefactory mode] (>>Simple Factory mode>>SimpleFactory Design Pattern)

----Summary----

    1.The creation method inFactory class is static(So the Simple Factory Mode isalso called,Static Factory Mode), like this.

    2.When create the Propertyin interface, you have to set it as format: double{get;},like this.

    3.When using ifelse format, or switch case format, you have touse else for if else, and use default for switchcase, like this.

----Example----(>>Simple Factory DesignPattern Example)

    Example 1.

 

>>Transaction:

*How to use transaction:(>>How to usetransaction)

[.Net] (>>.Net Transaction>>C#Transaction>>ASP.net Transaction)

    http://jims57.blog.163.com/blog/static/9513617201041375653915/

[SQL] (>>How to use SQLTransaction>>SQL Transactions)

----Example---- (>>SQL Transactionexample)

    Example 1.

 

>>Log:

*Log Tool:(>>Log Component)

[Apache Tool] (>>Apache Log Tools)

    log4net1.2.10 //The made-to-measure tool is designed for .Net, which can logthe error to: File,DB,Email or Console.

   (Or G:/Backup/Software/Log/Apache/log4net-1.2.10(For DotNet))

    ----Info----

        http://jims57.blog.163.com/blog/static/95136172010329115736763/      

    ---->>How to useApache Log Tools----(>>How to use log tools)

       1.Reference the Log4Net Component by "AddReference" option.    

       2.Configure Log4Net in Web.config, like this.(>>ConfigureLog4Net in XML)

        3.Startthe Log4net at Global.asax, like this.

        4.Writethe Log Class, like this.(>>Log4Net Class>>Log Class)

        5.Usethe Log class, like this.(>>Use Log4net object)

 

>>Div:

*Div event:(>>Div events)

---->>Onclick event----(>>Set divclick event>>set div onclick event)

 

>>Insert:

*inert element:(>>Insertelements>>Insert object>>add elements>>add objects)

[JQuery](>>Insert element by jQuery)

    1.InsertAfter Example1.    (>>InsertAfter)

    2.Append example, (>>insert element by append>>Add divelements>>Append object>>Add span text>>set spantext>>select object by jQuery)

 

>>WebService:(>>Web Service)

*How to use Webservice:(>>How to usewebservice>>How to use web service>>use web service>>UseWebservices)

----My Practice----

http://jims57.blog.163.com/blog/static/95136172010320019621/

http://jims57.blog.163.com/blog/static/9513617201052654039202/  //Practice2(>>sql output variables>>Output variables)

---->>WebServicesummary----(>>Web Service summary)

    1.Use [WebMethod] to make a class[The class must be public] as part of web service, like this.

    2.Webservice namespaceis using System.Web.Services;//(>>WebService namespace>>Webservice namespace)

----My Practise----

    1.Set up webservice,like this.(>>How to set up webservice)

    2.Reference the webserviceby "Web Reference" item.

    2.Use the webservice atanother application, like this.(>>How to use webservice at client)

 

>>Remoting:(>>Distributedsystem>>Remote Object)

*How to use remoting:(>>How to useremoting>>how to use .net remoting)

[ASP.Net]|[C#]    

----Remoting Steps----(>>RemotingSteps)

    1.Remote Class: Create aremote class, just inherit MarshalByRefObject, see this. (>>Create Remoting class)

    2.Server: Add thenamespace, like Example 1.

    3.Server: Open the Channelby "TcpServerChannel Tcp=new TcpServerChannel(8888);"// Portnumber:8888

    4.Server: RegisterChannel(Tcp) by "ChannelServices.RegisterChannel(channel, false);".

    5.Server: Configure theRemote Class at server by "RemotingConfiguration.RegisterWellKnownServiceType(typeof(Hello),"HelloWorld", WellKnownObjectMode.SingleCall);".

    6.Client: Open the Channelby "TcpClientChannel Tcp=new TcpClientChannel();"//Any port.

    7.Client: Register Channelby "ChannelServices.RegisterChannel(Tcp,false);".

    8.Client: Get the remoteclass by "Class1C=(Class1)Activater.GetObject(typeof(Hello),"tcp://serverIP:8888/SayHello");".

    9.Client: Use the Class1 asthe normal class now.

----Example----(>>RemotingExamples>>.Net Remoting Examples)

    [My example]

        {Way1}(Recommend)

           1.Set up remote class, like this.//Like other class creation, the class just inherits from MarshalByRefObject.(>>Setup remote class)

           2.Register RemoteClass at server,like this.(>>Register Remoteclass at server>>Registerremote class at server>>Register Remoting Class)

           3.Use RemoteClass at Client, like this.(>>Use Remoteclass by client>>Use Remote Classby client)

        {Way2}(Use XML configuration file to finish)

           1.Set up the remoting class. //The remoting class isthe class which will be accessed by remote client.exe.

           2.Set up the XML configuration file at server. //TheXML file must be in the same folder as server.exe.(>>Server remoting XMLfile)

           3.Set up server.exe.

           4.Set up the XML configuration file at Client.//Savethe XML in the same folder as client.exe.(>>Remoting Client XML file)

           5.Set up client.exe.

    [Examples]

        Example 1.

        Example 2.

---->>Remoting Summary----

        1.Remoting isconsist of RemoteClassServer and Client,like this.//RemoteClass is the shared command collection betweenserver and client.

        2.RemoteClass shouldinherit System.MarshalByRefObject, like this. (>>Inherit MarshallByRefObject)

        3.[Server] :Reference System.Runtime.Remoting and the RemoteClass.//Toreference the Remoting is for TcpServerChannel.

        4.TheMethods in Remote Class CAN NOT be static type,otherwise, the client can not use it.

        5.Haveto use "using System.Runtime.Remoting.Channels.Tcp;" to use"TcpServerChannel T=new TcpServerChannel(8888);"

        6.Haveto use "using System.Runtime.Remoting.Channels;" to use "ChannelServrices".(>>ChannelService Namespace)

        7.Haveto use "using System.Runtime.Remoting;" to use "RemotingConfiguration".

       9.[Client]: Use “Activator.GetObject” to get the remote class,like "Hello obj = (Hello)Activator.GetObject(typeof(Hello),"tcp://localhost:8888/HelloWorld");"

       10.ClientEnd and ServerEnd have to reference the "RemoteClass".

       11.Server register the remote class do not have IP, like "RemotingConfiguration.RegisterWellKnownServiceType(typeof(Hello),"HelloWorld", WellKnownObjectMode.SingleCall);"

       12.Client register need to specify the server IP, like "Hello obj= (Hello)Activator.GetObject(typeof(Hello),"tcp://localhost:8888/HelloWorld");".

----WCF[.Net 3.5]----//Like remoting tech.which is new in .NET 3.5

    {Info}

        1.Info1

    

>>WCF:

*How to use WCF:(>>How to useWCF>>How to set up WCF)

[C#] (>>C# WCF)

----Summary----(>>WCF Summary>>C#WCF Summary>>.Net WCF summary)

    1.Binding hassomething to deal with Host, if IIS, you have to use HTTP binding, like this.

    2.Binding type aredifferent, please see the binding list here. (>>WCF binding type)

    3.You have use namespace"using System.ServiceModel.Channels;" to use the Binding type,like this. (>>Binding namespace)

    4.The interface hasto define as public, if not the HostService cannot reference, like this.

    5.ServiceAddress haveto be full path, can not just specify the Function name, like this.

    6.The delegate class inClient has to use the same function name to refer to the service function,like this.

----My Example----

    Service Host Class (>>WCF servicehost class)

    WCF Client Class (>>WCF ClientClass>>WCF Delegate class>>WCF Client delegate class)

----Example----(>>Create WCF example)

    Example 1.

    Example 2.

    Example 3.

----Steps----

    Steps.(>>How to build WCF)

 

>>JQuery:

*JQuery summary(>>jquery summary)

    1.jQuery has no disable() or enable() function,you should add it yourself by $.fn to extend it, like this.//(>>jQueryextended functions>>Extend jQuery functions>>JQuery disable()>>JQueryenable()>>JQuery foreach>>JS foreach>>Javascriptforeach>>$.fn)

 

*How to use JQuery:(>>How to useJQuery)

----Link----(>>JQuery Link) //You candownload jQuery here.

1.Download jQuery.

2.Insert JQuery at <title>, like this. //(>>Insert Jquery>>insert javascriptscript>>insert js script)

3.Use it, like example.

 

*JQuery Script:(>>JQuery Script)

 Script 1.//Developmentversion(Full Version)

 

*JQuery Selector:(>>JQuerySelectors>>Selectors)

---->>Get JQuery selectorsize----(>>Get jquery length>>Get jquery array size>>GetjQuery array length)

    $("img").size()//Get the size of all selected <img> element array.

----Select method----

$("#showDiv")   //Selectobject with ID="showDiv", =document.getElementById("#showDiv"), showDiv is the ID in a object

$(".CssName")  //Select theobject with the Css Name

$("li>a")  //Get all<a> in <li>, do not include the grandson <a>

$("a[id]") //select all <a>with id properties

$("a[href*=abc]") //select all<a> with the abc text is included in href.

$("a[href^=abc]") //select all<a> with abc text as prefix in href

$("a[href$=pdf]")  //Get allhyperlink with "pdf" as suffix in href properties

$("li:has(a)")  //selectall <a> which is in <li>.

$("p:first-child") //select all<p> which is the first one in its father element, like this.It has the father container.(>>Select first child)

$("p:odd")  //Get the odd row<p>

$("td:nth-child(1)")  //Getthe the first column of the table.or $("td:nth-child(odd)")$("td:nth-child(even)"),$("td:nth-child(5n+1)"), which do not need the father container.

$("p:eq(3)")  //selectthe 4th p in the html page, index begin as 0. 

$("div p:first") //select first<p> in <div>

$("div p:last") //last <p> in<div>

$("p:only-child") //select the<p> which has no brother.

$("p:gt(0)") //All <p> afterthe first <p>, do not include the first one. 0={index number}

$("p:lt(3)") //All the <p>before the 4th <p>, 0={index number}

$("input[name=" + sCheckName +"]:checked") //select the input which are checked status and nameproperties=sCheckName value.

$(":input")  //select all<input>,<select>,<textarea> and <button>, 

                 example: $(":input:not(:checkbox):not(radio)") =select all input element butno<checkbox> and <radio>

 

*JQuery study link:(>>JQueryLink>>JQuery Study Link)

    ----Link----

       Link1 (Jacobrecommend>>JQuery Album>>JQuery rotated pictures>>Album)

 

>>Menu:

*Menu Control:(>>Menu Control)

[ASP.Net] (>>ASP.Net Menu Control)

    ---->>Menu Event----

        1.Menu Item Click Event. //(>>Get Menuselected values)        

 

>>CSS:

*CSS Study:(>>CSS Study>>StudyCSS)

----Link---- 

    http://www.w3school.com.cn/css/css_background.asp  

 

*Set Css style:(>>Set CSSstyle>>Set Css type)

[JQuery](>>Set css style byJquery>>Set css by jQuery)

    1.Set table row style by row oddor even. //(>>Set odd row css style>>Set even row css style)

    2.Set child css type for li. //(>>Sethtml list css type>>set list child type>>Set li css type)

    3.Set css by properties. //(>>Set css byproperties>>select object by properties>>select object by jQuery)

 

*Set border color(>>Set CSS bordercolor>>Set border color by CSS>>Border color by CSS>>CSSBorder Color>>Set border type>>How to use CSS>>Ahover>><A> hover):

----Example----

http://jims57.blog.163.com/blog/static/9513617201021642138848/

---->>Add CSS file----(>>Add css file>>insertcss files>>Add stylesheet file>>how to insert css file>>howto add css file>>Css file)    

---->>Use CSS files----(>>reference CSSfiles>>how to use css file)

 

>>Array:

*Pass Array: (>>Pass array>>Passc# array to JS>>C# array to JS)

       ####----Example1----####

       ##----JS----##

       //Youcan get the testArray set in C# code directly.

       <script language="javascript">

    functionclickMe() {

        alert(testArray[1].toString());

    }

       </script>

       ##----Code----##

               protectedvoid Page_Load(objectsender, EventArgs e)

        {

 

            List<string> tempString = newList<string>();//(>>newilist>>new generic arraylist>>New list>>StringList>>new String List)

            tempString.Add("Hello");

            tempString.Add("World");

 

            StringBuildersb = new StringBuilder();

            sb.Append("<script>");

            sb.Append("vartestArray = new Array;");

            foreach(string str intempString)

            {

                sb.Append("testArray.push('" + str + "');");//(>>Add item to jsarray>>Add data to js array)

            }

            sb.Append("</script>");

 

            ClientScript.RegisterStartupScript(this.GetType(), "TestArrayScript",sb.ToString());//(>>C# register js script>>C# register js code)

              }

 

*New Array:(>>New array)

[JS] (>>JS array>>Javascriptarray>>new js array>>New javascript array)

var aText=new Array();

aText[0]=document.createTextNode("jimtexg"); 

 

*Copy array:(>>Copy array)

[ASP.Net]

    1.    

    ----Method 1----

    public static void Copy(ArraySourceArray,Array DestinationArray,int LengthYouWillCopy);//Copy from index 0,if Length=3, end index=2.

    ----Example----

    int[]M_AryOld={5,4,3,2,1};

    int[] M_AryNew=new int[3];

   Array.Copy(M_AryOld,M_AryNew,3);//return 5,4,3

    2.

    ----Method 2----

    public static voidCopyTo(Array DestinationArray,int StartCopyIndex);

    ----Exampe----

    int[]M_AryOld={5,4,3,2,1};

    int[] M_AryNew=new int[7];

   M_AryOld.CopyTo(M_AryNew,2);//return 0,0,5,4,3,2,1. 2 means the copybegin as index 2.

  

*Array Contains:(>>Array contains)

---->>Check array has item ornot----(>>Check array contains item or not)

   M_StrArray.Contains("3");//If M_StrArray has the 3, returntrue.

 

*Array Item:(>>Array Items)

---->>Find array items----

int result=Array.BinarySearch(M_StrArray,3);//Return2, if M_StrArray={1,2,3,4,5}

 

*Array sort:(>>Array sort>>Orderarray>>Order data>>Sort Data)

---->>Sort Array----

[ASP.Net|C#]

   ArrayList.Sort(M_StrsIAmArray);//if {5,4,3,2,1} will become {1,2,3,4,5}

---->>Reverse array----

[ASP.Net|C#]

    ArrayList.Sort();

   ArrayList.Reverse(M_StrArray);//If you want to get a descending order bynumber, you should first ArrayList.Sort(), and then ArrayList.Reverse();

[JS]

    varaDiv=$("div").get(); //get <div> array

    aDiv.reverse(); //reversethe array you got.

 

*Array count:(>>Array count)

---->>Get Array count----

for(inti=Strs.GetLowerBound(0);i<Str.GetUpperBound(0);i++)//>>Get lowerbound>>Get upper bound

{

    ////TODO;

}

 

*Arrary Dimension:(>>Array Dimension)

---->>Get Array Dimension----

    int[] M_IntArray=newint[100];

    M_IntArray.Rank;//Returndimension of array.

 

>>Traversal:(>>Foreach)

*JS foreach:(>>Javascriptforeach>>JS foreach)

----Example----

        My Example1.(>>JS foreach textbox>>foreachtextbox by js>>foreach textbox>>foreach js textbox>>Get jsarray objects>>Get JS array items>>Get all textboxs by js)

        Example 2. (>>foreach JSON object>>Foreach byJSON)

        Example 3.(>>Js for in>>Javascript for in)

 

*Foreach ArrayList:(>>ForeachArrayList>>ArrayList foreach>>Array Traversal)

----Way 1----

    http://jims57.blog.163.com/blog/static/951361720103811015142/  //>>Additem to ArrayList

----Way 2----

   [GetEnumerator]>>Next item>>Get Next item

    http://jims57.blog.163.com/blog/static/951361720103811611991/ 

    //>>IEnumeratorNamespace>>Next item>>Get Next item>>Get ArrayList nextitem>>ArrayList next item

 

*SQL Foreach:(>>SQL Foreach)

----Example----

    Example 1.

 

>>DataAdapter:(>>DataAdapter>>DataSetTableAdapter)

*How to use DataSetDataAdapter:(>>Howto use DataSetDataAdapter>>How to useDataSetTableAdapter>>Strongly-type DataSet>>Strongly-TypeDS>>Strong type DS)

    ----My Practice----(Example Pic)

    1.>>GetStrongly-Type DS data

        [2 Tierstructure]

         Example 1: 

        [3 Tierstruecture](With Biz tier>>3 Tier structure for Strongly-type DS)

         Example (>>DataObject>>Data Object)

    2.>>ForeachStrongly-Type DataSet(>>Foreach strongly-Type DS)

    Example 2

    3.>>

  

>>Indexer:

*Indexer Summary:(>>Indexer summary)

    1.Indexer MUST BEinstancing object.(Can not static type)

 

*How to use indexer:(>>How to useindexer)

[.Net]

    ----Example 1----(>>How to use C#indexer)   

 

>>Serializable:

*Serialize object to file:(>>Serializeobject to file>>Save class into file>>Save object tofile>>How to use serialize>>Serialize class to file)

[C#]

----Steps----(>>Serializable steps)

    [Serialization Step](>>Serialization Steps)

    1.Add 3 necessarynamespaces, see Example 1.

    2.Add label at the classwhich is going to be serialized, [Serializable], see Example 1.

    3.Instantiate the class asobject before serialization.

    4.Instantiate a Formatterto serialize, like "IFormatter F=new BinaryFormatter()".

    5.Create Stream withaccess mode,including FileMode,FileAcces and FileShare, acronym "MAS".

    6.Serialize the object by"F.Serialize();".

    7.Close the existingstream.

    [Deserialization Steps](>>Deserialization Steps)

    1.Deserialization step, donot instantiate the class, just specify the file name, like "Stream S =new FileStream("Jim.bin", FileMode.Open, FileAccess.Read,FileShare.Read);".

    2.Deserialize do not needto specify the object, just "(ClassName)IFormatter(Stream);"

----Serializablesummary----:(>>Serializable summary)

    1.Deserializable DOT NOT have the Constructor.(Evenit has the instructor before serialized.)[For the sake of performance]

    2.The derived class whichinherited from a serialized father class MUST usethe [Serializable] as well.

    3.Before using "IFormatter",you have to add the namespace "using System.Runtime.Serialization".(>>IFormatterNamespace)

    4.Have to use "usingSystem.IO;" to use "Stream". (>>StreamNamespace)

    5.Have to use "usingSystem.Runtime.Serialization.Formatters.Binary" to use "BinaryFormatter".

    6.Have to close the steamafter serialization, or it can not serialize again, like"Stream.Close();"

----Example----(>>SerializableExamples)

    Example 1 (>>Binary to serialize object tofile) 

    Example 2 (>>Deserialize file to object)

    Example 3 (>>Selective to serialize object tofile)

 

>>Interface:

*Interface summary:(>>Interfacesummary>>What is interface)

    1.Can not beinstantidated.(Same as abstract class)

    2.Including the declarationof mehods not instantiated.(Same as abstract class)

    3.Derived class Mustinstantiate all the methods in interface, and all the member[Not Only Methods]

    4.Not only can theinterface include Mothods, but also PropertiesIndexer, Event,(All of them are public)

        Can notinclude: ConstantDomain,Instructor,Destructor and, Static member.

    5.A class can inherit manyInterface, but one class(Including abstract class).

 

>>Abstract:

*Abstract Class summary:(>>Abstractsummary>>Abstract class summary)

    1.A special class whichcan not be instantiated, it can only be the base class.

    2.It can include theabstract method.(Common class can not have any abstract method)

    3.The abstract method insbstract class MUST BE instantiated by child class.(Override)

    4.A abstract class can bederived from another abstract class, you can decide if overriding the abstractmethod in the father absract class or not.(If you do not override the abstractmethods in the father abstract class, you Must overridethem in the derived class. )

    5.If the inheriting classis inherited from the father class(like abstract class), the constructor forthe inheriting class must be the same as the father class constructor,including the parameters of function, if you want to add the more parametersfor the inheriting class constructor, you should use base tomake it, like this.(>>Inheriting class constructor>>How to usebase()>>What is base)

    6.The function Qualifier(publicprivate,protectedinternal)in inheriting class must be the same as the one in father class (or abstractclass).

    7.If you want to achieve afunction in abstract class, you do not need to use abstract qualifier,if you need abstract qualifier, can't achieve the abstract function(Itshould be achieved in inheriting class.)

    8.Abstract class canhave the normal function and achieve the function.

---->>Difference between abstract andinterface----

    http://jims57.blog.163.com/blog/static/9513617201031045037779/

    ---->>Differencebetween abstract class and interface----

    1.The function ininterface can not be achieved, just write like this.

    2.Abstract class in faceis a class which can achieve the function, like this.

    3.Abstract function inabstract class have to be use override key word in child class to override,just like virtual function. But Interface do not need to use override toachieve the function in interface, like this.

    4.Interface function cannot have any qualifier like public private etc., function inabstract class can use qualifier.

    5.All function ininterface are not achieved, but abstract class can achieve the function or notto be.

----Example----

    Example 1.(>>Abstract Class Example)

 

>>Constraint:

*ForeignKeyConstraint:(>>ForeignKeyConstraint>>ForeignKey Contraint)

----Foreach Constraint----(>>ForeachConstraint>>Foreach Foreign Key Constraint)

[ASP.Net]

   foreach(ForeignKeyConstraint CST inDS.Tables[0].Constraints)//>>Constraint collections

    {

    }

---->>How to use ForeignKeyConstraint----

    http://jims57.blog.163.com/blog/static/9513617201038113320604/ //>>EnforceConstraints>>new foreign key constraint>>new ForeignKeyConstraints

 

>>RadioButton:(>>Radio Button)

*RadioButton event:(>>Radio Buttonevent>>RadioButton Event)

http://jims57.blog.163.com/blog/static/951361720103842458616/ //>>GroupName>>Groupname>>How to use Radio button

>>Button:

*Button Event:(>>Button Event)

http://jims57.blog.163.com/blog/static/95136172010384613490/ //ButtonArgument>>Button>>Link button event to button>>Link event tobutton

 

>>Input:

*User Input:(>>User Input)

---->>Get user inputinfo----(>>Input user info)

[JS]

        variNumber=Number(prompt("Please input your infonumber."));//>>convert string to number

[C#]

    stringM_Str=Console.ReadLine(); //M_Str get user input info afteruser Enter the keyboard   

 

>>Stack:

*Stack item count:(>>Stack itemcount>>Stack items count)

Stack.Count;

 

*Import Stack:(>>Importstack>>Add item to stack>>Input Stack>>Input stack items)

[ASP.Net]

    1.Stack.Push(item);//itemis object type or any other type.

 

*Output Stack:(>>OutputStack>>Export stack>>Remove item from stack>>Output stackitems)

[ASP.Net] 

    Stack.Pop();//Remove aitem

 

*Stack NameSpace:(>>Stack NameSpace)

System.Collections;

 

>>Queue:

*Queue items count:(>>Queue itemscount>>Queue item count)

Queue.Count;

 

*Output Queue:(>>OutputQueue>>Export Queue)

[ASP.Net]

    Queue.Dequeue();//Output aitem in Queue with order:First inFirst Out.

 

*Import Queue:(>>ImportQueue>>Add item to queue>>Enqueue>>Input queue)

[ASP.Net]

    Queue.Enqueue(item);//item can be object type, like int etc.

 

*New Queue:(>>New Queue)

http://jims57.blog.163.com/blog/static/951361720103813341779/


*Queue NameSpace:(>>Queue Namespace)

System.Collections;

 

>>Relation:

*Data Relation:(>>DataRelation>>DataRelation)

---->>New Data Relation----(>>NewRelation>>New DataRelation)

[ASP.Net]

    {DataSet}

    http://jims57.blog.163.com/blog/static/9513617201037114548900/ 

    //(>>DataSetRelation Collections>>New DataSet Relations>>New DSrelation>>New DS data relation)

 

>>CommandBuilder:

*>>Update DB data:(>>Update DBdata>>Update DataBase data)

[ASP.Net]    

    http://jims57.blog.163.com/blog/static/951361720103783230986/ //(>>Updatedata to DB by CommandBuilder)

----Another way----

    DataAdapter.UpdateCommand,InsertCommand, DeleteCommand will be used to update the DB as well by justDataAdapter and Command without CommandBuilder, see example. //Use CommandBuilder to update the DB withDataAdapter.

    

>>DataRow:(>>Data Row)

*Child DataRow:(>>Child DataRow)

---->>Get ChildDataRows----(>>Get child data rows)

[ASP.Net]

    DataRowParentDR=DS.Tables["Table1"].Rows.Find("12");//12 is theauthoer ID(>>Find DataRow>>Find Data Row>>Find DataTablerows)

    DaraRow[]ChildDR=ParentDR.GetChildRows("RelationName");

    //DS has been set theDataRelation with "RelationName".ChildDR are the datarow got byparentrow with relation name.    

 

*Add DataRow:(>>Add DataRow>>AddData Row>>Add row data>>Add new row data)

[ASP.Net]

    DataRowDR=DataTable.NewRow();//>>Add new row by DataTable

[JS] (>>Add JS row>>AddJavascript row>>Insert JS row>>Insert javascript row)

    varoTr=document.getElementById("TableID").insertRow(2); //Insert a newrow at index 2(index begin as 0), it means insert the row as the third row

 

*Delete DataRow:(>>DeleteDataRow>>Delete Data Row>>Delete Row>>Remove datarow)

[ASP.Net]

   1.DataRowCollection.Remove(DataRow row);//Delete actually, see example:

    2.DataRow.Delete();//Markas deleted, not deleted actually.If you want to delete it actually, dofollowing:

        publicvoid AcceptChanges(); //Deleted after that, or RejectChanges() toundo.(>>Accept Change)

 

*Find data row:(>>Finddatarow>>Find data row)

 [ASP.Net]

    DataRowCollectionDRC=DataSet.Tables[0].Rows;//>>Data row collection>>DataRowCollection

    DataRow DR=null;

   DR=DRC.Find("PrimaryKeyText");

    //Tables[0] has been setthe primary,search for the info by Set Primary key,you can use"PrimaryKeyText" to find out the related row.

 

>>Data:

*Order data:(>>Order data>>SortData)

[ASP.Net]

    {DataTable}

        http://jims57.blog.163.com/blog/static/951361720103775819918/ //>>Orderdata by DataTable>>DataRow

    {DataView}(>>DV sortdata>>DataView Sort data)

       DataView.Sort="BookAuthor";//Sort by book author. Or.Sort="BookAuthor asc"

 

>>Primary key:

*Set Primary key:(>>Set primary key)

[ASP.Net]

    1.

    DataColumn[] dc=newDataColumn[1];//>>New data columns>>New DataColumns

   dc[0]=DataSet.Tables[0].Columns[0];

   DataSet.Tables[0].PrimaryKey=dc;//>>Data Column>>Set datatableprimarykey>>Set DataTable primary key

        

    

>>Address:

*IP Address:(>>IP Address)

---->>Get user ipaddress----(>>Get client address>>Get client IP address>>Getuser host address>>User host address)

[ASP.Net]

   Request.UserHostAddress;//return string.

 

>>Inherit:

*Inherit father method:(>>Inheritfather method>>Inherited method>>Inherited class)

    [ASP.Net]

       base.FatherMethod("Value");//base means the father class,"FatherMethod" is a method name in father class.

 

>>Pass Value(>>Out>>Ref>>Outand Ref>>Ref and out)

*Difference between Out andRef(>>Difference between Out and Ref>>Out values):

1.out在进入函数前,可以不赋值,但ref一定要赋值进入函数;

2.out在退出函数时,一定有值被赋于,而ref可赋也可以不赋值。

3.Ref will change the original value.

----Example 1----(>>outparameters>>ref parameters>>Out example>>Ref example)

http://jims57.blog.163.com/blog/static/9513617200910110364899/edit/?mode=prev

 

>>Host:

*Host name:

---->>Get Host name----

[ASP.Net]

   HttpContext.Current.Request.Url.Host;//>>HttpContext>>HttpContext host name>>Get current pc IPaddress>>Get current PC host name

 

>>Server:

*Server string:(>>Serverstring>>Server connection string>>Connection string)

---->>Set Server connectionstring----(>>Set connection string)

[Asp.Net]

    {Web.Config}

    http://jims57.blog.163.com/blog/static/9513617201035113536314/  

    {C#}

   SqlConnection.ConnectionString=ConnectionString;//ConnectionString willbe set in web.config.      

---->>Get Server Connection string----(>>Getconnection string)

[Asp.Net]

    1.{Get from Web.config}

        Way 1:

          System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionName"].ToString();

        Way 2:

           Example.

    2.{>>Get server connectionstring by SqlDataSource}    

 

>>Ajax:(>>Asynchronization)

*How to asynchronize:(>>How toasynchronize>>How to do asynchronization)

----Steps----(>>Create Async objectsteps>>Asynchronization steps)

    1.Create Async object(Youhave to check which browser is using, and then create the relatedXMLHttpRequest object), like Example 1.

    2.Open the server.aspxpage, like"AsyncObj.open("GET","Server.aspx",true);".

    3.Set the property,onreadystatechange, see Exmaple 1.

    4.Send request by"AsyncObj.send(null);"

    5.Get the response from serverby "AsyncObj.responseText" after sending the request in Step 4.

----Summary----(>>AsynchronizationSummary>>Ajax Summary>>XMLHttpRequest Summary)

    1.innerHTML have to useupperCase to show, like"document.getElementById("MyID").innerHTML=XMLRequest.responseText;, see Example 1.

    2.Attention to thecase-sensitive about both "AcyncObj=newActiveXObject("Microsoft.XMLHTTP")" and "AcyncObj=newXMLHttpRequest();".The     

       HTTP in Microsoft.XMLHTTP isuppercase, but Http in XMLHttpRequest is not all uppercase.

    3. "GET" and"POST" have to be upper case, like"AcyncObj.open("GET","Server.aspx",true);"

    4. When "GET",use "AcyncObj.send(null);"(use "null") to send, if"POST" you have to add the HttpHeader like this"AsyncObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");"(>>Async object header>>Post request header>>Post header)

    5.Server.aspx HTML shouldbe deleted, for the responseText will include all the html the server.aspxhas,just use it like this. 

    6.If you have the ServerControl, you have to use "onClientClick" to use the js, like this. (>>Use JS functions>>How to use jsfunctions>>How to use javascript functions>>Use Javascriptfunctions)

    7.If you want to doasynchronization, you'd better use <input> not <ASP:Button> to dothe async, for the <ASP:Button> has the problem when doing theasynchronization.

    8.[JQuery]: If you useload(url,[data],[callback])  to get the async data, use "GET" torequest when without data, if data is involved in the request, it is"POST", if you have to use "GET" to request and want the[data] as well, you should use "?ID=12" format to finish.

----Example----

[Ajax] (>>How to use Ajax>>How touse XMLHttpRequest)

    Example 1. (>>Use async object)

[JQuery] (>>How to use JQueryAjax>>JQuery Ajax)

----Info----

    Info 1. (From Jacob)

----Example----

    Example 2. (>>Get async data by JQuery)

 

*Ajax Composition:(>>AjaxComposition>>Ajax Objects)

Javascript,Css,DOM, XMLHttpRequest

 

*About XMLHttpRequest:(>>AboutXMLHttpRequest>>About Async object>>About asynchronous object)

----Create XMLHttpRequestObject----(>>Create HttpXMLRequest Object>>Create Asyncobject>>Create Asynchronous object)

    http://blog.163.com/jims57/blog/static/9513617201032101425683  

 

*XMLHttpRequestReadyState:(>>XMLHttpRequestReadyState>>ReadyState>>XMLHttpRequest State>>CheckXMLHttpRequest State>>Check State)

    http://jims57.blog.163.com/blog/static/951361720103395417467/

 

*Send XMLHttpRequest Request::(>>SendXMLHttpRequest Request>>Send Request to server>>Createrequest>>Set up request>>send async request)

   XMLHttpRequest.Open("GET","Page.Aspx",true);//Method={GET,POST}

----Example----(>>Send async request)

    Example 1. (>>Send Async Request by GET)

 

>>Socket:

*How to use Socket:(>>How to usesocket)

----Example----(>>Socket Examples)

    Example 1.

    Example 2.//Good example even some format errors.

 

*Set up Socket:(>>Set upsocket>>Establish socket>>New UDP socket>>NewSocket>>Create socket object)

[For Udp]

    Socket socket = newSocket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);//>>Udp>>AddressFamily>>Socket Type>>SocketType

[For Tcp]

    Socket S = newSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

 

>>Constant:

*How to use constant:(>>Constant)

[C#]

public const int port = 11000;//>>C#constant>>Define C# Constant>>Define Constant

 

>>Chat:

*Send and receive message:(>>SendMessage>>Receive message)

http://jims57.blog.163.com/blog/static/95136172010325144940/

 

>>GUID:

*GUID type:(>>GUID Type)

SqlParameter.SqlDbType=SqlDbType.Guid;>>SqlDbType>>DBType>>Sql DB Type

 

>>Certificat:(>>Security)

*SSL Certificate:(>>SSLCertificate>>Get SSL Certificate>>Get Securitycertificate>>Get Certificate>>Get SSL Security certificate)

[VeriSign](>>VeriSign)

    ----Link----

        http://www.Verisign.com

    ----Info----

        ASP.Net 2.0电子商务开发实践》 P.367

 

>>HyperLink:

*How to use Hyperlink:(>>How to useHyperlink)

[ASP.Net]

    <Asp:HyperLinkrunat="server" ID="ID"NavigateUrl="~/Register.aspx" Text="ClickMeText" ToolTip="Goregister page" CssClass="UserInfoLinkCss"/>//>>Relative path>>ToolTip>>CssClass>>Navigate Url

 

>>User:

*Create User:(>>Create user)

[ASP.Net]

   {Membership}(>>Create user by membership)

        MembershipUser user=Membership.CreateUser("UserName","PWD","Email","QuestionToGetBackPassword","Answer",true,out status);//true=Allow user to login,status=return status ofuser

 

>>User Controls:

*How to use User Controls:(>>How to use UserControls)

http://jims57.blog.163.com/blog/static/951361720103111450442/

 

>>List:

*How to use List:(>>How to use List)

----Example----

Example 1. (>>New List)

Example 2.

Example 3. (>>Add listitems)

 

>>Password:
*Set Password rules:(>>Set password rules>>web.config passwordformat>>Password rules>>Set password format)

[ASP.Net]

    Set in ASPNetSqlMembershipProvider inmachine.config or web.config

 

>>Membership:

*How to use Membership:(>>How to use Membership)

----Step----(>>Use membership steps)

    1.Create Table scheme byaspnet_regsql.exe automatically.(C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727)

    2.Setting for MemberShipProvider andRoleManagerProvider,like this.(>>Set Membersip in web.config)

    3.Write coding by membership and MembershipUser,like this.

 

*Membership Database:(>>Membershipdatabase>>Membership DB)

---->>Create membership db----(>>Createmembership database)

    1.Create the related DB table byaspnet_regsql.exe.(C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727)

---->>Combine membership database into existingDB----(>>Combine membership DB to existing DB>>CombineDB>>Combine membership database):

    a.Run "Visual Studio 2008Command" from start button.    

    b.Type "aspnet_regsql.exe".

    Reference:<<亮剑.Net ASP.NET商业级数据库网站开发实践>> P.331

 

*MemberShip namespace:(>>Membership namespace)

[ASP.Net]

    System.Web.Security.MemberShip;

 

*Get User ID by MemberShip:(>>Get User ID bymembership>>Get UserID by memebership)

MemberShip.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey; //>>HttpContext>>Get Current user object>>GetUser>>Getuser>>Identity

 

>>Profiles:(>>User Info)

*Set Profiles:(>>Set Profile>>Set user info)

[ASP.Net]   

    http://jims57.blog.163.com/blog/static/9513617201023111112811/ //>>Get User>>MemberShipget user>>HttpContext.Current>>Get Current HttpContext

 

>>SqlDataSource:

*Set SqlDataSource:(>>Set SqlDataSource)

<Asp:SqlDataSource ID="ID"runat="server"ConnectionString="<%$ConnectionStrings:BallonShopConnection%>"SelectCommand="Select [ID],[Name] from [Table1]"/>  

//ConnectionString:BallonShopConnection is set inWeb.Config //SqlDataSource Connection string>>Set ConnectionString>>Set Connectionstring>>Select Command

 

>>Roles:

*Add roles:(>>Add roles)

[ASP.Net]

    {CreateUserWizard}

        http://jims57.blog.163.com/blog/static/95136172010230112438123/ //>>Sender as>>Getsender>>CreateUserWizard

        ----Remark----

        You can add the newrole manually by tool named "Web Site Administrator Tool" provided byASP.Net.

 

>>Encrypt:(>>Encryption>>MD5>>SHA1>>DES>>3DES)

*How to Hash password:(>>How toencrypt>>Encrypt password>>Hash Password>>HashString>>How to hash password)

[SHA1]

    http://jims57.blog.163.com/blog/static/95136172010229115624546/  //>>ToBase64String>>ToSHA1 string

[DES]

    http://jims57.blog.163.com/blog/static/95136172010591461411/

 

*Encrypt and Decrypt:(>>How to encrypt and decryptstring>>Encrypt string>>Decrypt data>>Encryptdata>>Decrypt string)

http://jims57.blog.163.com/blog/static/95136172010230104316110/ //>>Get byte fromstring>>ReadToEnd>>Flush datatrin

 

>>Load:(>>PreRender>>Init)

*Load Summary:(>>Load Summary>>PreRenderSummary)

[ASP.Net]

    PreRender: Load before loadmethod    

 

>>Session:

*Session Data:(>>Session Data)

---->>Set Session data----

[ASP.Net]

   Session.Add("key1","value1");

---->>Get session data----

[ASP.Net]

    Session.Contents["key1"];

 

*Get session:(>>Get Sessions)

[ASP.Net]

    {HttpContext}//>>HttpContext>>GetHttpContext Session:

        HttpContextContext=HttpContext.Current;

        objectSession=Context.Session["CartID"];

 

>>DropDownList:(>>DDL)

*DDL Items:(>>DDL Items)

---->>Add DDL items----

[JS]

    ####----Example1(Replacevalue)----####

        functionReplaceOption(Box,iNum)

        {

           var oForm=document.forms["myForm1"];

           var oBox=oForm.elements[Box];

           var oOption=new Option("苹果","Apple");//(>>JSnew option>>new options)

           oBox.option[iNum]=oOption;
        }

    ####----Example2----####
             functionReplaceOption(Box,iNum)
        {
            varoForm=document.forms["myForm1"];
            varoBox=oForm.elements[Box];
            varoOption=new Option("
苹果","Apple");//(>>JSnew option>>new options)
           oBox.insertBefore(oOption,oBox.options[iNum]); //(>>Insert before value)
        }

>>Controlss:

*Customized control:(>>Customized control)

---->>Make customized controls----(>>Registercustomized controls)

[.Net]

    ##----Example(Website)----##

        Example 1.

---->>Register Customizedcontrols----(>>Register controls)

[ASP.Net]

    ##----Example----##

        Example 1.

---->>Add Customized control Icon----(>>Addcontrol icon)    

 

*Load Control:(>>Load Control>>LoadUC>>Load User controls)

[ASP.Net](>>ASP.Net load user control)

    Controlc=Page.LoadControl(Request.ApplicationPath+"/Aspfile.ascx");

    ContentPlaceHolder.Controls.Add(c);

 

>>Stored Procedure:

*Stored Procedure Type:(>>Stored procedure type)

---->>Set Stored Procedure type----

   SqlCommand.CommandType=CommandType.StoredProcedure;// >>CommandType>>CommandType

 

*How to use store procedure(>>How to use storeprocedure>>How to use stored procedure):

[C#]

----Example 1----

http://jims57.blog.163.com/blog/static/951361720091012093574/edit/?mode=prev 

[Oracle] (>>how to use oracle stored procedure)

    ####----Example1----####

       ##----SQL----##        

DROP TABLE depttab;

CREATE TABLE depttab (deptno NUMBER(2), dnameVARCHAR2(14));

 

CREATE OR REPLACE PROCEDURE Test_Arraybind(pdeptnoNUMBER,

                                         pdname VARCHAR2) IS  

BEGIN  

  INSERT INTO depttab (deptno, dname) VALUES (pdeptno, pdname);  

  COMMIT;  

END;  

        ## ----Code(CreateConnection)----##            

string connectStr = "User Id=scott; Password=tiger;Data Source=orcl9i";//(>>Oracle user id)

OracleConnection connection;

connection = new OracleConnection(connectStr);

connection.Open();

       ##----Code(Command)----##(>>Create Oracle Command>>CreateCommand>>Create OracleCommand)

OracleCommand cmd1 = newOracleCommand("",connection);

cmd1.CommandText= "Test_Arraybind";

cmd1.CommandType = CommandType.StoredProcedure;

       ##----Code(Array)----##    (>>Oracle Use Arrayparameters)

int[] myArrayDeptNo = new int[3]{1, 2, 3};

String[] myArrayDeptName = {"Dev","QA", "Facility"};

cmd1.ArrayBindCount = 3;//(>>Set Command Array Count)

        ##----Code(ArrayParameters)----##(>>Oracle Pass array parameters>>Pass ArrayParameters)    

OracleParameter deptNoParam = newOracleParameter("deptno",OracleDbType.Int32);//(>>OracleInt Type>>Oracle Int32 Type>>Create Oracle Parameters>>CreateParameters)

deptNoParam.Direction = ParameterDirection.Input;//(>>SetParameter direction>>Set Oracle Parameter direction)

deptNoParam.Value = myArrayDeptNo;

cmd1.Parameters.Add(deptNoParam);

 

OracleParameter deptNameParam = newOracleParameter("deptname",

                                                  OracleDbType.Varchar2);

deptNameParam.Direction = ParameterDirection.Input;

deptNameParam.Value = myArrayDeptName;

cmd1.Parameters.Add(deptNameParam);

        ##---Code(ExecuteCommand)----##

try

{

cmd1.ExecuteNonQuery();//(>>Oracle Command Executenon query>>Command ExecuteNonQuery)

Console.WriteLine("{0} Rows Inserted" ,cmd1.ArrayBindCount);}

catch (Exception e)

{

Console.WriteLine("Execution Failed:" +e.Message);

}

        ##----Code(DisposeConnection)----##

OracleCommand cmd2 = newOracleCommand("",connection);

cmd2.CommandText = "DELETE depttab WHERE deptno =:1";//(>>With parameter sql>>With Parameter oracle sql)

cmd2.ArrayBindCount = 3;

OracleParameter param1 = new OracleParameter();

param1.OracleDbType = OracleDbType.Int32;

param1.Value = myArrayDeptNo;

cmd2.Parameters.Add(param1);

 

try

{

cmd2.ExecuteNonQuery();

Console.WriteLine("Cleaned DeptTab tabledata");

}

catch (Exception e)

{

Console.WriteLine("Cleanup Failed:{0}",e.Message);}

finally

{

cmd1.Dispose();//(>>Dispose Command>>DisposeOracle Command)

cmd2.Dispose();

 

connection.Close();//(>>Close Oracleconnection>>Close connection)

connection.Dispose();

}

    ##----SQL----##

        ----Example1----(>>SetOracle variable values>>Oracle Exception>>Oracle error>>Getoracle error info>>Set oracle variable value by select sentences)

 

*Execute Stored procedure in StoredProcedure:(>>Exec SQL stored procedure>>Exec SQL storedprocedure>>sql exec>>Execute Stored procedure in StoredProcedure>>Exec Stored Procedure>>Set variable by storedprocedure>>Set variables by stored procedure)

http://jims57.blog.163.com/blog/static/95136172009112595446906/edit/?mode=prev

http://jims57.blog.163.com/blog/static/9513617201022805433955/  //>>GetDate()>>GetCurrent DateTime>>Execute SQL stored procedure

 

>>Oracle:

*Oracle Summary:

    ----My Summary----

        1.Use TruncateTable (not Delete Table, Drop table) to delete table. see Info 1 fordetail.

        2.Do not use Notin, for it is very slow,it will search for the each record, use + totake the place of it.

    ----Info----

        Info 1.

 

*.Net use Oracle:(>>.Net use Oralce>>.Net andOracle>>How to use Oracle by .net>>How to useODP.net>>ODP.net)

    ----Steps----

        1.Download ODP.netfrom here.

           //Or from my local laptop:  G:/Backup/Software/DataBase/Oracle/For.Net/ODP.Net/ODTwithODAC1110621.zip

           (>>Download odp.net>>Download ODAC)

        2.InstallODP.net.//It will install ODP.net automatically when install Oracle throughOracle Installer Universal if there are .net installed on your PC already.

        2.DownloadOracle.(>>Download Oracle 11g>>Install Oracle on windows XP)

           //Or from my laptop: G:/Backup/Software/DataBase/Oracle/DB/win32_11gR1_database_1013.zip

        3.InstallOracle,like this.

        2.Add reference,like this.(>>AddODP.net reference>>Reference ODP.net)

        1.Set Oracleconnection string at Web.config file, like this. //ForODP.net.(>>Oracle connection string>>Set Oracle connection string)

        2.Write connectioncode by Oracle component, OracleDataAccess.dll, like this. (>>Connectto Oracle Database)

    ----Example----(>>ODP.netExample)

        Example 1.

    ----Info----

        Info 1.

 

>>Row:

*Row Values:(>>Row Values)

---->>Get Row Values----

    [ASP.Net]

   ---->>ASPxGridView----(>>Get ASPxGridView Row Values)

        ----Example1----(>>GetRow>>Get ASPxGridView Selected Rows)

        ----Example2----(>>Rowevent to get row values>>Get row values by row event)

 

*Row Event:(>>Row Event)

---->>Change Row Event----(>>Row changeevent)

    [ASP.Net]

        ----ASPxGridView----(>>ASPxGridViewrow change event>>3 party gridview row change event)

            Example 1.

 

*Delete Rows:(>>Delete Rows>>Row delete)

[Javascript](>>Delele table row by javascript)   

---->>Delete duplicate row----

    [Oracle] (>>Delete Oracleduplicate row records)

        ----Example1----(>>Oracleloop>>oracle while>>Oracle covert to char>>OracleOutput>>Create Oracle stored procedure>>Oracle ifelse>>Oracle check find or not>>Oracle row count)

 

*Add rows:(>>Add rows)

[Javascript] (>>Add table row by javascript)    

 

>>Hide:

*Hide Field:(>>Hide Fields)

[ASP.Net]

    ----ASPxGridView----(>>HideASPxGridView Fields)

        ----Example1----   



>>VSS:(>>Visual SourceSafe)

*How to use VSS:(>>How to use VSS)

    ----Steps----

        1.Download VSSfrom here.

           Or my laptop: (>>Download VSS>>Download Visual SourceSafe)

        2.Install andconfigurate VSS, like this.//Info 2.Info 3.(>>InstallVSS>Configure VSS)        

 

>>ExtJS:

*ExtJS website:(>>ExtJSWebsite>>ExtJS>>ExtJS study website)

 Link 1:www.Extjs.com //Official website

 Link 2:http://www.ajaxjs.com/ //Chinese version (>>ExtJSstudy>>Study ExtJS)

 

>>Authorization:

*How to use authorization:(>>How to useauthorization)

----Summary----(>>Authorization summary)

    1.If you want to specify which folderor page the user can not access, just add the node <location> outsidethe <authorization>, like this.

 

>>Web.Config:

*Web.Config Summary:(>>Web.config summary)

    Summary 1.

 

*Web.Config Namespace:(>>Web.config namespace)

System.Configuration.ConfigurationManager;

 

*AppSetting Value:(>>AppSettingsValue>>AppSetting value)

---->>Get AppSettings values----(>>GetAppsetting values)

[ASP.Net]

   ConfigurationSettings.AppSettings["ConnectionString"];

 

*Save Variable in Web.Config:(>>Save Variable inWeb.config>>Variable in Web.Config>>AppSettings Variables)

[C#]

http://blog.163.com/jims57/blog/static/95136172010215101812158 //>>ConfigurationManager>>ConfigurationManager  

 

*Set page access right:(>>user accessright>>user right>>Set page access right>>Allow pageaccess>>Deny page access>Allow access>Deny access>>Deny Useraccess>>Allow User access)

[ASP.net]

    ----Info----

    Info 1.(>>Web.Config Authorizationconfiguration>>Authorization>>deny user access page>>Denyuser access specific page)

    Info 2.(>>Web.Config Authentication Configuration)

    Info 3.(>>Deny userto access path>>Deny user to access specific folder>>Deny user toaccess folder>>Authorization node usage>>Use web.configauthorization).

 

>>UML:

*How to use UML:(>>How to use UML)

---->>What is UML----

    Info 1.(>>UMLstructure)

 

>>Software Engineering:

*Software Project Management:(>>Software ProjectManagement>>Software Management>>Software Management)

----Study----(>>Software Project ManagementInfo>>Software Engineering Study)

    Info 1.

---->>Steps----

    1.

---->>Software engineering tools----(>>Projectmanagement tools>>Software management tools)

    1.Rose (Case Tool):For Requirement Analysis and Design phrase

    2.MS SourceSafe: For CodingVersion Control.

    3.S-Design(Or PowerDesigner,PowerBuilder,BusinessObject): For DB creation.

    4.Project 2007: For ProjectFollowing Tool.

    5.HTML Help Workshop(hhw.exe):For Help Document.

    6.SCCS: It is Control System tomodify source code.

    7.MRCS: Control system tomodify requirement.

---->>Software Development Process----

    [Waterfall Model](>>Waterfallmodel)

       ----Picture----    

            Pic 1.

---->>Software Management Summary----

    1.Consider the software integrally, donot just focus on the coding.

    2.Consider the problem at user's view,user is the god of software.

    3.Com+ is better than .Dll.

    4.B/S is better than C/S.

    5.Take note while developing thesotware, note for good idea or hard problem.

 

>>HttpHandler:(>>HttpModule)

*Difference between HttpHandler andHttpModule:(>>Difference between HttpHandler and HttpModule)

    ----Summary----

        1.Action orderHttpModule first, HttpHandler later.//If depends on the event, for soem events, the HttpModule willaction later.

        2.Handle FileTypeHttpModule will handle all file type, but HttpHandler willonly handle the file registered before, like aspx, asmx etc.

        3.Handle ContentHttpHandler willcreate the response content by your request, but HttpModule willdo other, like pre-handle, validation(It also can handle the request contentlike HttpHandler can do.) // You can see the Chart to know detail.(>>Relationbetween HttpHandler and HttpModule)

        4.HttpModule:用于页面处理前和处理后的一些事件的处理HttpHandler:进行真正的页面的处理

    ----Info----

        Info 1.

 

*How to use HttpHandler:(>>How to use HttpHandler)

----Steps----(>>Use HttpHandler Steps>>Stepsto use HttpHandler>>Step to use HttpHandler)

        Info 1. (>>Classinherited from IHttpHandler)

 

>>Generic:

*How to use Generic Type:(>>How to use GenericType)

----Summary----(>>Generic TypeSummary>>Generic Summary)

    1.You have to add the namespace beforeyou can use GenericusingSystem.Collections.Generic; (>>Generic Namespace)

    2.ArrayList Generic typeis: List<T>. (>>ArrayList Generic Type>>List<T>>>C#vector>>Vector)

----Example----

    My Example 1.

 

*ArrayList Generic Type:(>>ArrayList GenericType>>List<T>)

---->>New List<T>----(>>New ArrayList generictype)

    List<string> L = newList<string>();//List<int> myList=new List<int>();

---->>How to use list<t>----(>>How touse ArrayList generic type)

    ----Example----

        Example 1.

        Example 2.(>>FindList<T> object>>Find ArrayList Gener Type child objects)

 

>>Internal:(>>Internal key word)

*What is internal:(>>What is internal key word)

[C#] (>>C# internal key word)

    ----Info----

        Info 1.

 

>>Timeout:

*setTimeout:(>>SetTimeout>>Settimeout>>Delay action>>Delay function>>Delay function to act)

[JS](>>JS settimeout>>Javascript settimeout)

----Example----

    Example 1.

 

>>Across language:

*.Net and Java:(>>.Net and java>>Java ans.Net)

---->>.Net use Java functions----(>>C# usejava functions)

    ----Info----

        Info 1.

 

>>Try catch:

*How to use try catch:(>>How to use try catch)

[JS](>>How to use js try catch)(>>JS trycatch)

    ----Example----

        Example1.

 

>>Calendar:

*Calendar Control:(>>Calendar Controls)

[Javascript]

---->>JS Calendar control----(>>Javascriptcalendar controls>>JS calendar controls)

    Info 1. (>>Downloadjs calendar control>>Download Javascript calendar control)

 

>>DataBase:(>>DB>>Data Acess)

*DB Tool:(>>DB Tools>>DataBase Tools)

[ODP.net](>>ODP.net)

    ---->>What is Odp.net----

           ODP.NET ORACLE公司为.NET开发者发布的一个 .NET 使用 ORACLE 数据库的类库 

 

*DB Class:(>>DB Class>>DB accessclass>>Database access class>>DB Framework>>Databaseframework)

[Data Access Application Block] (>>Data AccessApplication Block)

----->>What is Data Access Application Block----

    Info 1.   

 

>>Exam:(>>Examination)

*Job Interview Exam:(>>InterviewExamination>>Job Interview Examination>>C# Examination>>.NetExamination)

    ----Info----

        Info 1.

        Info 2.

 

>>3 Tier Structure:(>>3 tiers Structures)

*ObjectDataSource:(>>ObjectDataSource 3 tierstructure>>Object Data Source Control)

----Summary----

    1.You have to create the App_Code andthen set up the class in it before you can use the ObjectDataSource toaccess the data, like this.

    2.You have to create the classthe ObjectDataSource can access to in the App_Code folder,like this.

----Steps----

    File 1.

 

>>TreeView:

*How to use TreeView:(>>How to use TreeView)

[C#] (>>How to use C# TreeView>>C# treeview)

    ----My Example----(>>TreeViewExamples>>My TreeView Examples)

        Example 1.(>>Check ifselecting the node>>Check TreeView selection)

        Example 2.(>>SetTreeView ImageList>>Set TreeView Icons>>TreeView Icons>>Howto use ImageList>>Use ImageList>>Image from file)

 

*TreeView Events:(>>TreeView Events)

---->>TreeView Select node events----

    Example 1.

 

>>MVC:

*How to use MVC:(>>How to use MVC)

 

>>Base:

*How to use base:(>>How to use base)

[C#] (>>C# base key words)

    ----Example----

        Example 1.

        Example 2.

 

>>Virtual:

---->>How to use Virtual----

[C#] (>>How to use C# Virtual>>C# virtual)

    ----Summary----(>>C# virtualsummary>>Virtual summary>>Virtual class summary)

        1.Virtual functioncan be instantiated, like this.

        2.When override thefunction in father class, you should do like this.

        3.Virtual qualifiercan not be used with privatestaticabstract and override atthe same time, public is available.

        4.You can"override" the function in father class by new not override,like this.(>>Override father function by new)

        5.Virtual functioncan be in the normal class.

        6.Virtual cannotbe used with class, virtual class is wrong.

        7.Virtual functionhave to have the function body {},even you do not achieve thevirtual function, like this.

        8.You can eitheruse Override or new to override the virtualfunction in father class, like this.

        9.There are noorder for so-called public,virtual,abstract, you canuse as public virtual, or virtual public etc.

    ----Example----(>>C# Virtualexamples)

        Example 1.

>>Lock:(>>Lock key words)

---->>How to use Lock key words----

[C#] (>>C# lock key words)

    ----Summary----(>>Locksummary>>C# Lock summary)

    1.A thread is using a object at thesame time.(Can not have more than 1 thread using the same object or value.)

    2.If lock the current class object,just use lock(this){}, like this. (>>How to use lockthis>>Lock(this)>>Lock current class object)

    ----Example----

        Example 1.

 

>>Volatile:(>>Volatile key words)

---->>How to use volatile----(>>what isvolatile key words)

[C#] (>>C# Volatile key words)

    ----Example----

        Example 1.(>>Synchronized>>across thread access)

 

>>Singleton:(>>One instance class>>Onlyone instance class>>Singleton design pattern)

---->>How to use singleton----

[C#] (>>C# Singleton>>.NetSingleton>>C# one instance class>>>>how to use c#singleton>>how to use c# singleton)

    ----Summary----

        1.[Static method]You have to sealed the class, like this.

        2.[Static method]You have to set the constructor of class as private, anduse {}, like this.

        3.[Static method]You have to use private static readonly to define the memeber,like this.

    ----Example----(>>C# SingletonExample)

        Example 1.   

    ----My Example----

        My Example 1.

 

>>Params:

*Params Key word:(>>Params key words)

---->>How to use params----

[C#]

    ----Example----

    Example 1.

    Example 2.   

 

>>Linq:

*Linq to SQL:(>>Linq to SQL entity)

---->>How to use Linq to SQL----

[Create Linq to SQL entity] (>>Linq toSQL steps>>Create Linq to SQL Entity)

    ----Info----

    File 1.(Or at 163 netdisk: //PCInfo/How to use Linq to SQL.doc)

[Query DataContext Entity](>>QueryLinq to SQL Entity>>Linq Search>>Linq query>>How to use Linqto SQL to query data)

    ----Example----

    Example 1. (>>Linqformat>>Linq query format>>How to use Linq)

[Modify Linq to SQL entity]

    ----Example----

    Example 2. (>>Modify Linqdata)

 

>>SQL:

*SQL Summary:(>>SQL Summary)

    1.When you nest another SQL sentence,you should set the another SQL sentence alias, like this.

    2.Order by field nameshould not be appearred in the sub-SQL sentence, like this.

    3.When you set the alias for aspecific field, you can not just use number as alias, when you want to use thenumber as alias, you should add '', like this.

 

*Inner Join:(>>Inner Join>>RightJoin>>Left Join>>Cross Join)

---->>What is Inner Join----

    Info 1.

 

*Optimize SQL Sentence:(>>Improve SQLSentence>>Optimize SQL Sentence)

----Tool----

    Software: LECCO SQL Expert

    InfoInfo1(>>How to use LECCO SQL Expert)

----Summary----(>>SQL Optimizationsummary>>Improve SQL summary)

    1.Do not use "Select *"

 

*How to use Case When(>>How to use CaseWhen>>SQL Case When>>Case When>>SQL Case>>SQLIf else>>when case>>SQL when case):

[SQL]

----Way 1----

select 

    case

        when name='jim'then 'J'

        when name='Mark'then 'M'

        else 'Other'

    end 

from tb_Test

----Way 2----    

select 

    case name

        when 'jim' then 'J'

        when 'Mark' then'M'

        else 'Other'

    end 

from tb_Test

----Way 3----

    Like this.

----Info----

    Info 1

 

*@@Identity:(>>@@Identity>>New ID>>Newcreated ID>>Get new ID>>Get new created ID)

----Remark----

    The @@Identity is the new ID afterjust using insert into table(Name) values(@Name)

----How to set----

    [SQL]

    Declare @ProductID int //>>Define SQL Variables>>Define Variables

    Select @ProductID=@@Identity//Set SQLVariables or use "Set @ProduectID=@@Identity" to set >>SetVariables        

 

*Inner Join:(>>Inner Join>>Join>>How touse Join>>How to use inner Join)

Select Table1.ID, Name,Table2.Des from table1 inner jointable2 on where table1.ID=table2.ID

 

*Not in(>>Not in>>SQL Not In):

select * from aa where id not in(select id from bb)

 

*SQL Insert into format(>>SQL Insertformat>>SQL Insert into format):

insert into table1(Name) values(@Name)

 

*SQL Variables(>>Sql variables):

----Remark----(>>sql input variable>>incomesql variables>>Input variables>>input sql variables)

Input Variables can be less than the set variables in SQLsentence (Just use NULL), but it can not more than. 

Order of inputting variables can be different from theSQL variables

----Example----

http://jims57.blog.163.com/blog/static/951361720091026525782/ (>>Define SQL variables)

 

*SQL Boolean(>>SQL Boolean>>SQL true andfalse>>SQL bit)

For SQL sentence, the value is 1 or 0

For DB table,use true or false to set

For setting value, use "true" or"false" to set the value

 

*Set SQL Variables(>>Set SQL Variables):

Declare @Var Varchar(20) //>>Define SQL variables

Set @Var='123'

 

*SQL Null(>>SQL Null>>How to use SQLNull>>Select SQL Null>>Null>>DB null):

select * from table1 where name is null

 

*SQL Case Sensitive:(>>SQL Case Sensitive)

----Remark----

In SQL sentence, there is not Case Sensitive in inquirysentence.Like select * from table1 where Name='JIM'(or Name='jim')[The same]

 

[Update] (>>SQL Update)

*Update the multi rows at the same time(>>Updatemulti rows>>Update Multi-rows>>Update Many rows at the sametimes>>SQL Update multi rows>>SQL UpdateMulti-rows>>SQL Update Many rows):

----Way 1----

update tb_Test3 set [Sum]=T2.S from tb_Test3,(selectTYPE,YEAR(Date) Y,SUM(Price) S from tb_Test2 group by Type,Year(Date)) T2 whereyear(tb_Test3.Y)=T2.Y and tb_Test3.[Type]=T2.[Type]

//Sum field is the field which need to be updated.

----Way 2----(>>Update many different rows at thesame time>>Update at the same time)

http://jims57.blog.163.com/blog/static/95136172009101281434390/edit/?mode=prev

 

*Set SQL variable value(>>Set SQL Variable Value):

Select @OldCount=[COUNT] from tb2_SupportInfo


*SQL Sentence:
[C#]
SQL server: string StrSQL=Select [Name] from [Form1];

*Read the sheet in a excel(>>Read Excel):
StrCon = "select * from [sheet2$] where Price>20" 

 

>>Error:

*Check errors:(>>Check error>>Check errorstatus)

[SQL] (>>Check SQL Errors>>Check SQL errorstatus)

----Example----

    Example 1.(>>@@Error>>SQLError>>SQL @@Error)

 

*Custom Errors:(>>Custom Errors>>CustomizedError)

---->>Custom Error Page----(>>Customizederror page)

[ASP.Net]

    ##----Web.config----##

        Example 1

>>JSON:(Javascript Object Notation)

*JSON Format:(>>JSON format)

    Format 1. //Compare XMLwith JSON.

    Format 2.

 

*How to use JSON:(>>How to use JSON)

----Summary----

    1.JSON is Case-Sensitive.

    2.You have to use"eval("("+JSON_text+")");" format to change thestring in JSON_text variable into JSON, see Example 1.

    3.For array in JSON, it will use"[]" to include the items of array, see format 2.

    4.JSON basic format is: "Name":"Jim", use "" to mark itemand value, use : to divide the item and value, use , to separateto another item and value.

----Example----

    Example 1. (>>JSEval()>>Get JSON data>>Change string into JSON)

 

>>Cell:

*New Cell:(>>New Cell>>Insert Cell)

[JS] (>>Insert JS new Cell>>Insert jscell>>Add JS cell>>Add javascript cell)

    varoTr=document.getElementById("TableID").insertRow(2); //Index begin as0

    var oTd=oTr.insertCell(0); //insertthe cell as the first cell into the oTr.        

 

>>Convert:

*Convert Row to Column:(>>Row toColumn>>Convert Row to column>>Change row to column>>exchangerow and column)

[SQL] (>>SQL row to column)

---->>SQL Row to column summary----

    1.Have to use Max().

    2.Have to use Group By, see followingexample 1.

    3.For Dynamic method: Have to use asA, like example2.

    4.Have to use the alias, like AA, BB.See example 3.

    5.Field name which have been groupedby  must to appear, like My Example 1.

---->>SQL Row to column Examples----

    [SQL 2000]

    Example 1.   //Static method (>>SQL case when end)

    Example 2.   //Dynamic method (>>Build sql string>>Exec sql>>SQLCase when end>>Define sql variables>>Set sql variable)

    [SQL 2005]

    Example 3.  //2005static method(>>Pivot>>SQL pivot)

----My Example----

    My Example 1.

 

>>Division:

*SQL Division:(>>SQL Division)

8/4=2 //return 2

9/4=2.25 //return 2

11/4=2.75 //return 2

 

>>Prototype:

[JS] (>>Javascript prototype>>JS prototype):

*JS prototype:(>>JS prototype>>JavascriptPrototype>>Prototype>>JS OOP>>Javascript OOP)

----My Example----(>>My JS prototypeexamples>>JS prototype examples)

    My Example 1.

    My Example 2

----Example----

    Example 1.

    Example 2.

----Summary----(>>JS prototype summary>>Javascriptprototype summary)

    1.Prototype in JS can beviewed as Base (father class) in C#.

    2.function people() { } canbe viewed as the constructor in C#.

    3.Father class and child class is thesame structure, just child has a difference at ChinesePeople.prototype= new people();

    4.You can either tochange the prototype by ChinesePeople.prototype = new people(); ornot.(If not, child class will use the father property, use its prototype)

    5.Every properties or function showhas the prototype keyword, like this.

[C#]

----Example----

    Example 3.

 

*JS file:(>>Javascript File>>JS File)

---->>Add Js File----(>>insert jsfile>>insert javascript file>>how to add js file>>how toinsert js file>>reference js file>>How to add javascriptfile>>How to insert javascript file)

    Example 1.

*Javascript summary:(>>js summary>>javascriptsummary)

    1.When using the function, you caneither use the semicolon or not, like this. //(>>use javascriptfunctions>>how to use js function)

    2.JS have to foreach keyword, if you want to use foreach, you should do, like this, or use jQuery .each(),like this.(You should use for in to foreach injs, like 

this.)

    3.JS array do not need to specify thecapacity of array when newing the array by var ary=new array();,you can add the items in the array directly, by 

ary[0]="jim";, like this.

    4.For In in JS meansfor(int i=0;i<ary.Length;++){} in C# language, see this.

    5.var var=document.getElementsByTagName("input") is pluralwith "s" in Elements, pay attention to it, this sentence (Bold characters)is get all the textbox, including:<ASP:TextBox> and <inputtype="text"> in aspx page at the same time,like this.

    6.If you need to add thethird tier single quotation mark in JS function you should use /' to make it,like this(Red color part).

 

*Javascript and DDL:(>>Javascript and ddl>>JSand DDL>>Js and dropdownlist)

---->>Check DDL selection----(>>JS check ddlselection>>JS get ddl selection)

    ####----Example1----####   

        ##----JS----##

            <scriptlanguage="javascript">

               var oForm=document.forms["myForm1"];//(>>JS get forms)

               var oSelectBox=oForm.selectionID;

               var iChoice=oSelectBox.selectedIndex;//(>>JS getddl selected index)

               alert("你选中了"+oSelectBox.options[iChoic].text);//(>>JS get ddl text>>JS get dropdownlist text)

           </script>

        ##----HTML----##

           <select id="selectionID" name="selectionID"

               <option value="Aries" selected="selected">白羊</option>

               <option value="Apple">苹果</option>

           </select>

    ####----Exmple2----####

        ##----JS----##

            <scriptlanguage="javascript">

               var oForm=document.forms["myForm1"];//(>>JS get forms)

               var oSelectBox=oForm.selectionID;

               var oChoices=new Array(); //(>>JSarray>>New js )

               for(var i=0;i<oSelectBox.options.length;i++)

               {

                   if(oSelectBox.options[i].selected)

                      oChoices.push(oSelectBox.options[i].text);//(>>add item to jsarray>>add value to js array)

               }               

               alert("你选中了"+oChoices.join());//(>>output js array values)

           </script>

           

*Floating DIV:(>>Floating Div>>FloatDiv>>Float Window>>Floating Windows>>Pop upwindows>>Pop up layer)

[Javascript]

http://jims57.blog.163.com/blog/static/95136172010283127154/

http://jims57.blog.163.com/blog/static/951361720102835231428/edit/

http://jims57.blog.163.com/blog/static/951361720102831617339/

[jQuery]

    http://jims57.blog.163.com/blog/static/9513617201022073955589/

    http://leotheme.cn/wp-content/uploads/Example/js/tipswindown

 

>>Class:

*Javascript Class:(>>JS Class>>Javascriptclass)

---->>JS Class Example----(>>Javascript Classexample)

    Example 1.

 

>>Design Mode:(>>Design Pattern>>DesignMethod)

*What is Design Mode:(>>What is DesignMode>>Design Mode explanation)

----Info----

    Info 1.

 

*Factory Design Mode:(>>Factory DesignMode>>Factory design method>>Factory Design pattern)

[Factory method mode]

----Summary----(>>Factory Design Pattern summary)

    1.The abstracted function in interface donot need the public qualifier, like "voidCPU();"(without public),see Info 1.

----Example----(>>Factory design mode example)

    Example 1. (>>How touse factory design pattern>>how to use factory mode>>Factorymode>>Factory pattern)

----Info----

    Info 1.

[Simple factory mode] (>>SimpleFactory mode>>Simple Factory Design Pattern)

----Summary----

    1.The creation method in Factory classis static(So the Simple Factory Mode isalso called,Static Factory Mode), like this.

    2.When create the Property ininterface, you have to set it as format: double{get;},like this.

    3.When using if else format,or switch case format, you have to use else for ifelse, and use default for switch case,like this.

----Example----(>>Simple Factory Design PatternExample)

    Example 1.

 

>>Transaction:

*How to use transaction:(>>How to use transaction)

[.Net] (>>.Net Transaction>>C#Transaction>>ASP.net Transaction)

    http://jims57.blog.163.com/blog/static/9513617201041375653915/

[SQL] (>>How to use SQL Transaction>>SQLTransactions)

----Example---- (>>SQL Transaction example)

    Example 1.

 

>>Log:

*Log Tool:(>>Log Component)

[Apache Tool] (>>Apache Log Tools)

    log4net 1.2.10 //The made-to-measure tool is designedfor .Net, which can log the error to: File,DB,Email or Console.

   (Or G:/Backup/Software/Log/Apache/log4net-1.2.10(For DotNet))

    ----Info----

        http://jims57.blog.163.com/blog/static/95136172010329115736763/       

    ---->>How to use Apache LogTools----(>>How to use log tools)

        1.Referencethe Log4Net Component by "Add Reference"option.    

        2.Configure Log4Netin Web.config, like this.(>>Configure Log4Net in XML)

        3.Start the Log4netat Global.asax, like this.

        4.Write the LogClass, like this.(>>Log4Net Class>>Log Class)

        5.Use the Logclass, like this.(>>Use Log4net object)

 

>>Div:

*Div event:(>>Div events)

---->>Onclick event----(>>Setdiv click event>>set div onclick event)

 

>>Insert:

*inert element:(>>Insert elements>>Insertobject>>add elements>>add objects)

[JQuery](>>Insert element by jQuery)

    1.InsertAfter Example1.   (>>InsertAfter)

    2.Append example, (>>insertelement by append>>Add div elements>>Append object>>Add spantext>>set span text>>select object by jQuery)

 

>>WebService:(>>Web Service)

*How to use Webservice:(>>How to usewebservice>>How to use web service>>use web service>>UseWebservices)

----My Practice----

http://jims57.blog.163.com/blog/static/95136172010320019621/

http://jims57.blog.163.com/blog/static/9513617201052654039202/  //Practice 2(>>sql outputvariables>>Output variables)

---->>WebService summary----(>>Web Servicesummary)

    1.Use [WebMethod] to make aclass[The class must be public] as part of web service, like this.

    2.Webservice namespace is usingSystem.Web.Services;//(>>WebService namespace>>Webservice namespace)

----My Practise----

    1.Set up webservice, like this.(>>How to set up webservice)

    2.Reference the webservice by"Web Reference" item.

    2.Use the webservice at anotherapplication, like this.(>>How to use webservice at client)

 

>>Remoting:(>>Distributedsystem>>Remote Object)

*How to use remoting:(>>How to useremoting>>how to use .net remoting)

[ASP.Net]|[C#]    

----Remoting Steps----(>>Remoting Steps)

    1.Remote Class: Create a remote class,just inherit MarshalByRefObject, see this. (>>Create Remoting class)

    2.Server: Add the namespace, likeExample 1.

    3.Server: Open the Channel by "TcpServerChannelTcp=new TcpServerChannel(8888);"// Port number:8888

    4.Server: Register Channel(Tcp) by"ChannelServices.RegisterChannel(channel, false);".

    5.Server: Configure the Remote Classat server by "RemotingConfiguration.RegisterWellKnownServiceType(typeof(Hello),"HelloWorld", WellKnownObjectMode.SingleCall);".

    6.Client: Open the Channel by "TcpClientChannelTcp=new TcpClientChannel();"//Any port.

    7.Client: Register Channel by "ChannelServices.RegisterChannel(Tcp,false);".

    8.Client: Get the remote class by"Class1 C=(Class1)Activater.GetObject(typeof(Hello),"tcp://serverIP:8888/SayHello");".

    9.Client: Use the Class1 asthe normal class now.

----Example----(>>Remoting Examples>>.NetRemoting Examples)

    [My example]

        {Way 1}(Recommend)

           1.Set up remote class, like this.//Like other class creation, the class justinherits from MarshalByRefObject.(>>Set up remote class)

           2.Register RemoteClass at server, like this.(>>Register Remoteclass atserver>>Register remote class at server>>Register Remoting Class)

           3.Use RemoteClass at Client, like this.(>>Use Remoteclass byclient>>Use Remote Class by client)

        {Way 2}(Use XMLconfiguration file to finish)

            1.Setup the remoting class. //The remoting class is the class which will be accessedby remote client.exe.

           2.Set up the XML configuration file at server. //The XML file must be inthe same folder as server.exe.(>>Server remoting XML file)

           3.Set up server.exe.

           4.Set up the XML configuration file at Client.//Save the XML in the samefolder as client.exe.(>>Remoting Client XML file)

           5.Set up client.exe.

    [Examples]

        Example 1.

        Example 2.

---->>Remoting Summary----

        1.Remoting isconsist of RemoteClassServer and Client,like this.//RemoteClass is the shared commandcollection between server and client.

        2.RemoteClass shouldinherit System.MarshalByRefObject, like this. (>>Inherit MarshallByRefObject)

        3.[Server] :Reference System.Runtime.Remoting and the RemoteClass.//Toreference the Remoting is for TcpServerChannel.

        4.The Methodsin Remote Class CAN NOT be static type,otherwise, the client can not use it.

        5.Have to use"using System.Runtime.Remoting.Channels.Tcp;" to use"TcpServerChannel T=new TcpServerChannel(8888);"

        6.Have to use"using System.Runtime.Remoting.Channels;" to use "ChannelServrices".(>>ChannelService Namespace)

        7.Have to use"using System.Runtime.Remoting;" to use "RemotingConfiguration".

        9.[Client]: Use “Activator.GetObject”to get the remote class, like "Hello obj = (Hello)Activator.GetObject(typeof(Hello),"tcp://localhost:8888/HelloWorld");"

        10.ClientEnd andServerEnd have to reference the "Remote Class".

        11.Server registerthe remote class do not have IP, like "RemotingConfiguration.RegisterWellKnownServiceType(typeof(Hello),"HelloWorld", WellKnownObjectMode.SingleCall);"

        12.Client registerneed to specify the server IP, like "Hello obj =(Hello)Activator.GetObject(typeof(Hello),"tcp://localhost:8888/HelloWorld");".

----WCF[.Net 3.5]----//Like remoting tech. which is newin .NET 3.5

    {Info}

        1.Info1

    

>>WCF:

*How to use WCF:(>>How to use WCF>>How to setup WCF)

[C#] (>>C# WCF)

----Summary----(>>WCF Summary>>C# WCF Summary>>.NetWCF summary)

    1.Binding has something todeal with Host, if IIS, you have to use HTTP binding, like this.

    2.Binding type aredifferent, please see the binding list here. (>>WCF binding type)

    3.You have use namespace "usingSystem.ServiceModel.Channels;" to use the Binding type,like this. (>>Binding namespace)

    4.The interface hasto define as public, if not the HostService cannot reference, like this.

    5.ServiceAddress have tobe full path, can not just specify the Function name, like this.

    6.The delegate class in Client has touse the same function name to refer to the service function, like this.

----My Example----

    Service Host Class (>>WCFservice host class)

    WCF Client Class (>>WCF Client Class>>WCF Delegateclass>>WCF Client delegate class)

----Example----(>>Create WCF example)

    Example 1.

    Example 2.

    Example 3.

----Steps----

    Steps.(>>How tobuild WCF)

 

>>JQuery:

*JQuery summary(>>jquery summary)

    1.jQuery has no disable() or enable() function,you should add it yourself by $.fn to extend it, like this.//(>>jQuery extendedfunctions>>Extend jQuery functions>>JQuery disable()>>JQueryenable()>>JQuery foreach>>JS foreach>>Javascriptforeach>>$.fn)

 

*How to use JQuery:(>>How to use JQuery)

----Link----(>>JQuery Link) //You candownload jQuery here.

1.Download jQuery.

2.Insert JQuery at <title>, like this. //(>>Insert Jquery>>insertjavascript script>>insert js script)

3.Use it, like example.

 

*JQuery Script:(>>JQuery Script)

 Script 1.//Development version(Full Version)

 

*JQuery Selector:(>>JQuerySelectors>>Selectors)

---->>Get JQuery selector size----(>>Getjquery length>>Get jquery array size>>Get jQuery array length)

    $("img").size() //Get thesize of all selected <img> element array.

----Select method----

$("#showDiv")   //Select object withID="showDiv", =document.getElementById("#showDiv"), showDiv is the IDin a object

$(".CssName")  //Select the object withthe Css Name

$("li>a")  //Get all <a> in<li>, do not include the grandson <a>

$("a[id]") //select all <a> with idproperties

$("a[href*=abc]") //select all <a> withthe abc text is included in href.

$("a[href^=abc]") //select all <a> withabc text as prefix in href

$("a[href$=pdf]")  //Get all hyperlinkwith "pdf" as suffix in href properties

$("li:has(a)")  //select all <a> whichis in <li>.

$("p:first-child") //select all <p> whichis the first one in its father element, like this.It has the father container.(>>Selectfirst child)

$("p:odd")  //Get the odd row <p>

$("td:nth-child(1)")  //Get the the firstcolumn of the table.or $("td:nth-child(odd)")$("td:nth-child(even)"),$("td:nth-child(5n+1)"), which do notneed the father container.

$("p:eq(3)")  //select the 4th pin the html page, index begin as 0. 

$("div p:first") //select first <p> in<div>

$("div p:last") //last <p> in <div>

$("p:only-child") //select the <p> whichhas no brother.

$("p:gt(0)") //All <p> after the first<p>, do not include the first one. 0={index number}

$("p:lt(3)") //All the <p> beforethe 4th <p>, 0={index number}

$("input[name=" + sCheckName +"]:checked") //select the input which are checked status and nameproperties=sCheckName value.

$(":input")  //select all <input>,<select>,<textarea>and <button>, 

                 example: $(":input:not(:checkbox):not(radio)") =select allinput element but no<checkbox> and <radio>

 

*JQuery study link:(>>JQuery Link>>JQueryStudy Link)

    ----Link----

       Link1 (Jacob recommend>>JQueryAlbum>>JQuery rotated pictures>>Album)

 

>>Menu:

*Menu Control:(>>Menu Control)

[ASP.Net] (>>ASP.Net Menu Control)

    ---->>Menu Event----

        1.Menu Item Click Event. //(>>GetMenu selected values)        

 

>>CSS:

*CSS Study:(>>CSS Study>>Study CSS)

----Link---- 

    http://www.w3school.com.cn/css/css_background.asp   

 

*Set Css style:(>>Set CSS style>>Set Csstype)

[JQuery](>>Set css style by Jquery>>Set cssby jQuery)

    1.Set table row style by row odd or even. //(>>Set odd row css style>>Seteven row css style)

    2.Set child css type for li. //(>>Set html list csstype>>set list child type>>Set li css type)

    3.Set css by properties. //(>>Setcss by properties>>select object by properties>>select object byjQuery)

 

*Set border color(>>Set CSS border color>>Setborder color by CSS>>Border color by CSS>>CSS BorderColor>>Set border type>>How to use CSS>>Ahover>><A> hover):

----Example----

http://jims57.blog.163.com/blog/static/9513617201021642138848/

---->>Add CSS file----(>>Addcss file>>insert css files>>Add stylesheet file>>how toinsert css file>>how to add css file>>Css file)    

---->>Use CSS files----(>>referenceCSS files>>how to use css file)

 

>>Array:

*New Array:(>>New array)

[JS] (>>JS array>>Javascript array>>newjs array>>New javascript array)

var aText=new Array();

aText[0]=document.createTextNode("jimtexg"); 

 

*Copy array:(>>Copy array)

[ASP.Net]

    1.    

    ----Method 1----

    public static void Copy(ArraySourceArray,Array DestinationArray,int LengthYouWillCopy);//Copy from index 0,if Length=3, end index=2.

    ----Example----

    int[] M_AryOld={5,4,3,2,1};

    int[] M_AryNew=new int[3];

    Array.Copy(M_AryOld,M_AryNew,3);//return5,4,3

    2.

    ----Method 2----

    public static void CopyTo(ArrayDestinationArray,int StartCopyIndex);

    ----Exampe----

    int[] M_AryOld={5,4,3,2,1};

    int[] M_AryNew=new int[7];

    M_AryOld.CopyTo(M_AryNew,2);//return0,0,5,4,3,2,1. 2 means the copy begin as index 2.

  

*Array Contains:(>>Array contains)

---->>Check array has item or not----(>>Checkarray contains item or not)

   M_StrArray.Contains("3");//If M_StrArray has the 3, returntrue.

 

*Array Item:(>>Array Items)

---->>Find array items----

int result=Array.BinarySearch(M_StrArray,3);//Return 2,if M_StrArray={1,2,3,4,5}

 

*Array sort:(>>Array sort>>Orderarray>>Order data>>Sort Data)

---->>Sort Array----

[ASP.Net|C#]

    ArrayList.Sort(M_StrsIAmArray);//if{5,4,3,2,1} will become {1,2,3,4,5}

---->>Reverse array----

[ASP.Net|C#]

    ArrayList.Sort();

    ArrayList.Reverse(M_StrArray);//If youwant to get a descending order by number, you should first ArrayList.Sort(),and then ArrayList.Reverse();

[JS]

    var aDiv=$("div").get();//get <div> array

    aDiv.reverse(); //reverse the arrayyou got.

 

*Array count:(>>Array count)

---->>Get Array count----

for(inti=Strs.GetLowerBound(0);i<Str.GetUpperBound(0);i++)//>>Get lowerbound>>Get upper bound

{

    ////TODO;

}

 

*Arrary Dimension:(>>Array Dimension)

---->>Get Array Dimension----

    int[] M_IntArray=new int[100];

    M_IntArray.Rank;//Return dimension ofarray.

 

>>Traversal:(>>Foreach)

*JS foreach:(>>Javascript foreach>>JSforeach)

----Example----

        My Example1.(>>JSforeach textbox>>foreach textbox by js>>foreachtextbox>>foreach js textbox>>Get js array objects>>Get JSarray items>>Get all textboxs by js)

        Example 2. (>>foreachJSON object>>Foreach by JSON)

        Example 3.(>>Js forin>>Javascript for in)

 

*Foreach ArrayList:(>>ForeachArrayList>>ArrayList foreach>>Array Traversal)

----Way 1----

    http://jims57.blog.163.com/blog/static/951361720103811015142/  //>>Add item to ArrayList

----Way 2----

    [GetEnumerator]>>Nextitem>>Get Next item

    http://jims57.blog.163.com/blog/static/951361720103811611991/ 

    //>>IEnumeratorNamespace>>Next item>>Get Next item>>Get ArrayList nextitem>>ArrayList next item

 

*SQLForeach:(>>SQL Foreach)

----Example----

    Example 1.

 

>>DataAdapter:(>>DataAdapter>>DataSetTableAdapter)

*How to use DataSetDataAdapter:(>>How to useDataSetDataAdapter>>How to use DataSetTableAdapter>>Strongly-typeDataSet>>Strongly-Type DS>>Strong type DS)

    ----My Practice----(Example Pic)

    1.>>Get Strongly-Type DS data

        [2 Tier structure]

         Example 1

        [3 Tierstruecture](With Biz tier>>3 Tier structure for Strongly-type DS)

         Example (>>DataObject>>DataObject)

    2.>>Foreach Strongly-TypeDataSet(>>Foreach strongly-Type DS)

    Example 2

    3.>>

  

>>Indexer:

*Indexer Summary:(>>Indexer summary)

    1.Indexer MUST BE instancingobject.(Can not static type)

 

*How to use indexer:(>>How to use indexer)

[.Net]

    ----Example 1----(>>How touse C# indexer)   

 

>>Serializable:

*Serialize object to file:(>>Serialize object tofile>>Save class into file>>Save object to file>>How to useserialize>>Serialize class to file)

[C#]

----Steps----(>>Serializable steps)

    [Serialization Step](>>Serialization Steps)

    1.Add 3 necessary namespaces, seeExample 1.

    2.Add label at the class which isgoing to be serialized, [Serializable], see Example 1.

    3.Instantiate the class as objectbefore serialization.

    4.Instantiate a Formatter toserialize, like "IFormatter F=new BinaryFormatter()".

    5.Create Stream with accessmode,including FileMode,FileAcces and FileShare, acronym "MAS".

    6.Serialize the object by"F.Serialize();".

    7.Close the existing stream.

    [Deserialization Steps](>>Deserialization Steps)

    1.Deserialization step, do notinstantiate the class, just specify the file name, like "Stream S = newFileStream("Jim.bin", FileMode.Open, FileAccess.Read,FileShare.Read);".

    2.Deserialize do not need to specifythe object, just "(ClassName)IFormatter(Stream);"

----Serializable summary----:(>>Serializablesummary)

    1.Deserializable DOT NOT havethe Constructor.(Even it has the instructor beforeserialized.)[For the sake of performance]

    2.The derived class which inheritedfrom a serialized father class MUST use the [Serializable] as well.

    3.Before using "IFormatter",you have to add the namespace "using System.Runtime.Serialization".(>>IFormatterNamespace)

    4.Have to use "usingSystem.IO;" to use "Stream". (>>StreamNamespace)

    5.Have to use "using System.Runtime.Serialization.Formatters.Binary"to use "BinaryFormatter".

    6.Have to close the steam afterserialization, or it can not serialize again, like "Stream.Close();"

----Example----(>>Serializable Examples)

    Example 1 (>>Binaryto serialize object to file) 

    Example 2 (>>Deserializefile to object)

    Example 3 (>>Selectiveto serialize object to file)

 

>>Interface:

*Interface summary:(>>Interface summary>>Whatis interface)

    1.Can not be instantidated.(Same asabstract class)

    2.Including the declaration of mehodsnot instantiated.(Same as abstract class)

    3.Derived class Must instantiate allthe methods in interface, and all the member[Not OnlyMethods]

    4.Not only can the interface includeMothods, but also PropertiesIndexer, Event,(All of them arepublic)

        Can notinclude: ConstantDomain,Instructor,Destructor and, Staticmember.

    5.A class can inherit many Interface,but one class(Including abstract class).

 

>>Abstract:

*Abstract Class summary:(>>Abstractsummary>>Abstract class summary)

    1.A special class which can not beinstantiated, it can only be the base class.

    2.It can include the abstractmethod.(Common class can not have any abstract method)

    3.The abstract method in sbstract class MUST BE instantiatedby child class.(Override)

    4.A abstract class can be derived fromanother abstract class, you can decide if overriding the abstract method in thefather absract class or not.(If you do not override the abstract methods in thefather abstract class, you Must override them in the derived class. )

    5.If the inheriting class is inheritedfrom the father class(like abstract class), the constructor forthe inheriting class must be the same as the father class constructor, includingthe parameters of function, if you want to add the more parameters for theinheriting class constructor, you should use base tomake it, like this.(>>Inheriting classconstructor>>How to use base()>>What is base)

    6.The function Qualifier(publicprivate,protectedinternal)in inheriting class must be the same as the one in father class (or abstractclass).

    7.If you want to achieve a functionin abstract class, you do not need to use abstract qualifier,if you need abstract qualifier, can't achieve the abstract function(Itshould be achieved in inheriting class.)

    8.Abstract class can havethe normal function and achieve the function.

---->>Difference between abstract and interface----

    http://jims57.blog.163.com/blog/static/9513617201031045037779/

    ---->>Difference betweenabstract class and interface----

    1.The function in interface can not beachieved, just write like this.

    2.Abstract class in face is a classwhich can achieve the function, like this.

    3.Abstract function in abstract classhave to be use override key word in child class to override, just like virtualfunction. But Interface do not need to use override to achieve the function ininterface, like this.

    4.Interface function can not have anyqualifier like public private etc., function in abstract classcan use qualifier.

    5.All function in interface are notachieved, but abstract class can achieve the function or not to be.

----Example----

    Example 1.(>>AbstractClass Example)

 

>>Constraint:

*ForeignKeyConstraint:(>>ForeignKeyConstraint>>ForeignKey Contraint)

----Foreach Constraint----(>>ForeachConstraint>>Foreach Foreign Key Constraint)

[ASP.Net]

    foreach(ForeignKeyConstraint CST inDS.Tables[0].Constraints)//>>Constraint collections

    {

    }

---->>How to use ForeignKeyConstraint----

    http://jims57.blog.163.com/blog/static/9513617201038113320604/ //>>EnforceConstraints>>new foreign key constraint>>new ForeignKeyConstraints

 

>>RadioButton:(>>Radio Button)

*RadioButton event:(>>Radio Buttonevent>>RadioButton Event)

http://jims57.blog.163.com/blog/static/951361720103842458616/ //>>GroupName>>Groupname>>How to use Radio button

>>Button:

*Button Event:(>>Button Event)

http://jims57.blog.163.com/blog/static/95136172010384613490/ //Button Argument>>Button>>Linkbutton event to button>>Link event to button

 

>>Input:

*User Input:(>>User Input)

---->>Get user input info----(>>Input userinfo)

[JS]

        variNumber=Number(prompt("Please input your infonumber."));//>>convert string to number

[C#]

    string M_Str=Console.ReadLine(); //M_Str getuser input info after user Enter the keyboard   

 

>>Stack:

*Stack item count:(>>Stack item count>>Stackitems count)

Stack.Count;

 

*Import Stack:(>>Import stack>>Add item tostack>>Input Stack>>Input stack items)

[ASP.Net]

    1.Stack.Push(item);//item is objecttype or any other type.

 

*Output Stack:(>>Output Stack>>Exportstack>>Remove item from stack>>Output stack items)

[ASP.Net] 

    Stack.Pop();//Remove a item

 

*Stack NameSpace:(>>Stack NameSpace)

System.Collections;

 

>>Queue:

*Queue items count:(>>Queue itemscount>>Queue item count)

Queue.Count;

 

*Output Queue:(>>Output Queue>>Export Queue)

[ASP.Net]

    Queue.Dequeue();//Output a item inQueue with order:First in First Out.

 

*Import Queue:(>>Import Queue>>Add item toqueue>>Enqueue>>Input queue)

[ASP.Net]

    Queue.Enqueue(item); //item can beobject type, like int etc.

 

*New Queue:(>>New Queue)

http://jims57.blog.163.com/blog/static/951361720103813341779/


*Queue NameSpace:(>>Queue Namespace)

System.Collections;

 

>>Relation:

*Data Relation:(>>DataRelation>>DataRelation)

---->>New Data Relation----(>>NewRelation>>New DataRelation)

[ASP.Net]

    {DataSet}

    http://jims57.blog.163.com/blog/static/9513617201037114548900/ 

    //(>>DataSet RelationCollections>>New DataSet Relations>>New DS relation>>New DSdata relation)

 

>>CommandBuilder:

*>>Update DB data:(>>Update DBdata>>Update DataBase data)

[ASP.Net]    

    http://jims57.blog.163.com/blog/static/951361720103783230986/ //(>>Update data to DB byCommandBuilder)

----Another way----

    DataAdapter.UpdateCommand,InsertCommand, DeleteCommand will be used to update the DB as well by justDataAdapter and Command without CommandBuilder, see example. //UseCommandBuilder to update the DB with DataAdapter.

    

>>DataRow:(>>Data Row)

*Child DataRow:(>>Child DataRow)

---->>Get Child DataRows----(>>Get child datarows)

[ASP.Net]

    DataRowParentDR=DS.Tables["Table1"].Rows.Find("12");//12 is the authoerID(>>Find DataRow>>Find Data Row>>Find DataTable rows)

    DaraRow[]ChildDR=ParentDR.GetChildRows("RelationName");

    //DS has been set the DataRelationwith "RelationName".ChildDR are the datarow got by parentrow withrelation name.    

 

*Add DataRow:(>>Add DataRow>>Add DataRow>>Add row data>>Add new row data)

[ASP.Net]

    DataRowDR=DataTable.NewRow();//>>Add new row by DataTable

[JS] (>>Add JS row>>Add Javascriptrow>>Insert JS row>>Insert javascript row)

    varoTr=document.getElementById("TableID").insertRow(2); //Insert a newrow at index 2(index begin as 0), it means insert the row as the third row

 

*Delete DataRow:(>>Delete DataRow>>DeleteData Row>>Delete Row>>Remove datarow)

[ASP.Net]

    1.DataRowCollection.Remove(DataRowrow);//Delete actually, see example:

    2.DataRow.Delete();//Mark as deleted,not deleted actually.If you want to delete it actually, do following:

        public voidAcceptChanges(); //Deleted after that, or RejectChanges() toundo.(>>Accept Change)

 

*Find data row:(>>Find datarow>>Find datarow)

 [ASP.Net]

    DataRowCollectionDRC=DataSet.Tables[0].Rows;//>>Data row collection>>DataRowCollection

    DataRow DR=null;

    DR=DRC.Find("PrimaryKeyText");

    //Tables[0] has been set theprimary,search for the info by Set Primary key,you can use"PrimaryKeyText" to find out the related row.

 

>>Data:

*Order data:(>>Order data>>Sort Data)

[ASP.Net]

    {DataTable}

        http://jims57.blog.163.com/blog/static/951361720103775819918/ //>>Order data byDataTable>>DataRow

    {DataView}(>>DV sortdata>>DataView Sort data)

       DataView.Sort="BookAuthor";//Sort by book author. Or.Sort="BookAuthor asc"

 

>>Primary key:

*Set Primary key:(>>Set primary key)

[ASP.Net]

    1.

    DataColumn[] dc=newDataColumn[1];//>>New data columns>>New DataColumns

    dc[0]=DataSet.Tables[0].Columns[0];

    DataSet.Tables[0].PrimaryKey=dc;//>>DataColumn>>Set datatable primarykey>>Set DataTable primary key

        

    

>>Address:

*IP Address:(>>IP Address)

---->>Get user ip address----(>>Get clientaddress>>Get client IP address>>Get user host address>>Userhost address)

[ASP.Net]

    Request.UserHostAddress;//returnstring.

 

>>Inherit:

*Inherit father method:(>>Inherit fathermethod>>Inherited method>>Inherited class)

    [ASP.Net]

       base.FatherMethod("Value");//base means the father class,"FatherMethod" is a method name in father class.

 

>>Pass Value(>>Out>>Ref>>Out andRef>>Ref and out)

*Difference between Out and Ref(>>Differencebetween Out and Ref>>Out values):

1.out在进入函数前,可以不赋值,但ref一定要赋值进入函数;

2.out在退出函数时,一定有值被赋于,而ref可赋也可以不赋值。

3.Ref will change the original value.

----Example 1----(>>out parameters>>refparameters>>Out example>>Ref example)

http://jims57.blog.163.com/blog/static/9513617200910110364899/edit/?mode=prev

 

>>Host:

*Host name:

---->>Get Host name----

[ASP.Net]

    HttpContext.Current.Request.Url.Host;//>>HttpContext>>HttpContext host name>>Get current pc IPaddress>>Get current PC host name

 

>>Server:

*Server string:(>>Server string>>Serverconnection string>>Connection string)

---->>Set Server connection string----(>>Setconnection string)

[Asp.Net]

    {Web.Config}

    http://jims57.blog.163.com/blog/static/9513617201035113536314/  

    {C#}

   SqlConnection.ConnectionString=ConnectionString;//ConnectionString willbe set in web.config.      

---->>Get Server Connection string----(>>Getconnection string)

[Asp.Net]

    1.{Get from Web.config}

        Way 1:

           System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionName"].ToString();

        Way 2:

            Example.

    2.{>>Get server connection string by SqlDataSource}    

 

>>Ajax:(>>Asynchronization)

*How to asynchronize:(>>How toasynchronize>>How to do asynchronization)

----Steps----(>>Create Async objectsteps>>Asynchronization steps)

    1.Create Async object(You have tocheck which browser is using, and then create the related XMLHttpRequestobject), like Example 1.

    2.Open the server.aspx page, like"AsyncObj.open("GET","Server.aspx",true);".

    3.Set the property,onreadystatechange, see Exmaple 1.

    4.Send request by"AsyncObj.send(null);"

    5.Get the response from server by"AsyncObj.responseText" after sending the request in Step 4.

----Summary----(>>Asynchronization Summary>>AjaxSummary>>XMLHttpRequest Summary)

    1.innerHTML have to use upperCase toshow, like"document.getElementById("MyID").innerHTML=XMLRequest.responseText;, see Example 1.

    2.Attention to the case-sensitiveabout both "AcyncObj=new ActiveXObject("Microsoft.XMLHTTP")"and "AcyncObj=new XMLHttpRequest();".The     

       HTTP in Microsoft.XMLHTTP isuppercase, but Http in XMLHttpRequest is not all uppercase.

    3. "GET" and"POST" have to be upper case, like"AcyncObj.open("GET","Server.aspx",true);"

    4. When "GET", use"AcyncObj.send(null);"(use "null") to send, if"POST" you have to add the HttpHeader like this"AsyncObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");"(>>Async object header>>Post request header>>Post header)

    5.Server.aspx HTML should be deleted,for the responseText will include all the html the server.aspx has,just use itlike this

    6.If you have the Server Control, youhave to use "onClientClick" to use the js, like this. (>>Use JS functions>>How to usejs functions>>How to use javascript functions>>Use Javascript functions)

    7.If you want to do asynchronization,you'd better use <input> not <ASP:Button> to do the async, for the<ASP:Button> has the problem when doing the asynchronization.

    8.[JQuery]: If you useload(url,[data],[callback])  to get the async data, use "GET" torequest when without data, if data is involved in the request, it is"POST", if you have to use "GET" to request and want the[data] as well, you should use "?ID=12" format to finish.

----Example----

[Ajax] (>>How to use Ajax>>How to use XMLHttpRequest)

    Example 1. (>>Useasync object)

[JQuery] (>>How to use JQuery Ajax>>JQueryAjax)

----Info----

    Info 1. (From Jacob)

----Example----

    Example 2. (>>Getasync data by JQuery)

 

*Ajax Composition:(>>Ajax Composition>>AjaxObjects)

Javascript,Css,DOM, XMLHttpRequest

 

*About XMLHttpRequest:(>>AboutXMLHttpRequest>>About Async object>>About asynchronous object)

----Create XMLHttpRequest Object----(>>CreateHttpXMLRequest Object>>Create Async object>>Create Asynchronous object)

    http://blog.163.com/jims57/blog/static/9513617201032101425683  

 

*XMLHttpRequest ReadyState:(>>XMLHttpRequestReadyState>>ReadyState>>XMLHttpRequest State>>Check XMLHttpRequestState>>Check State)

    http://jims57.blog.163.com/blog/static/951361720103395417467/

 

*Send XMLHttpRequest Request::(>>SendXMLHttpRequest Request>>Send Request to server>>Createrequest>>Set up request>>send async request)

   XMLHttpRequest.Open("GET","Page.Aspx",true);//Method={GET,POST}

----Example----(>>Send async request)

    Example 1. (>>SendAsync Request by GET)

 

>>Socket:

*How to use Socket:(>>How to use socket)

----Example----(>>Socket Examples)

    Example 1.

    Example 2.//Good exampleeven some format errors.

 

*Set up Socket:(>>Set up socket>>Establishsocket>>New UDP socket>>New Socket>>Create socket object)

[For Udp]

    Socket socket = newSocket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);//>>Udp>>AddressFamily>>Socket Type>>SocketType

[For Tcp]

    Socket S = newSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

 

>>Constant:

*How to use constant:(>>Constant)

[C#]

public const int port = 11000;//>>C#constant>>Define C# Constant>>Define Constant

 

>>Chat:

*Send and receive message:(>>SendMessage>>Receive message)

http://jims57.blog.163.com/blog/static/95136172010325144940/

 

>>GUID:

*GUID type:(>>GUID Type)

SqlParameter.SqlDbType=SqlDbType.Guid;>>SqlDbType>>DBType>>Sql DB Type

 

>>Certificat:(>>Security)

*SSL Certificate:(>>SSL Certificate>>Get SSLCertificate>>Get Security certificate>>Get Certificate>>GetSSL Security certificate)

[VeriSign](>>VeriSign)

    ----Link----

        http://www.Verisign.com

    ----Info----

        ASP.Net 2.0电子商务开发实践》 P.367

 

>>HyperLink:

*How to use Hyperlink:(>>How to use Hyperlink)

[ASP.Net]

    <Asp:HyperLinkrunat="server" ID="ID"NavigateUrl="~/Register.aspx" Text="ClickMeText"ToolTip="Go register page" CssClass="UserInfoLinkCss"/>//>>Relative path>>ToolTip>>CssClass>>Navigate Url

 

>>User:

*Create User:(>>Create user)

[ASP.Net]

    {Membership}(>>Create user bymembership)

         MembershipUseruser=Membership.CreateUser("UserName","PWD","Email","QuestionToGetBackPassword","Answer",true,out status);//true=Allow user tologin,status=return status of user

 

>>User Controls:

*How to use User Controls:(>>How to useUser Controls)

http://jims57.blog.163.com/blog/static/951361720103111450442/

 

>>List:

*How to use List:(>>How to use List)

----Example----

Example 1. (>>New List)

Example 2.

Example 3. (>>Add list items)

 

>>Password:
*Set Password rules:(>>Set password rules>>web.config passwordformat>>Password rules>>Set password format)

[ASP.Net]

    Set inASPNetSqlMembershipProvider in machine.config or web.config

 

>>Membership:

*How to use Membership:(>>How to useMembership)

----Step----(>>Use membership steps)

    1.Create Table scheme byaspnet_regsql.exe automatically.(C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727)

    2.Setting forMemberShipProvider and RoleManagerProvider,like this.(>>Set Membersipin web.config)

    3.Write coding by membership and MembershipUser,like this.

 

*Membership Database:(>>Membershipdatabase>>Membership DB)

---->>Create membershipdb----(>>Create membership database)

    1.Create the related DBtable by aspnet_regsql.exe.(C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727)

---->>Combine membership database intoexisting DB----(>>Combine membership DB to existing DB>>CombineDB>>Combine membership database):

    a.Run "Visual Studio2008 Command" from start button.    

    b.Type"aspnet_regsql.exe".

    Reference:<<亮剑.Net ASP.NET商业级数据库网站开发实践>> P.331

 

*MemberShip namespace:(>>Membershipnamespace)

[ASP.Net]

   System.Web.Security.MemberShip;

 

*Get User ID by MemberShip:(>>Get UserID by membership>>Get UserID by memebership)

MemberShip.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey; //>>HttpContext>>Get Current userobject>>GetUser>>Get user>>Identity

 

>>Profiles:(>>User Info)

*Set Profiles:(>>Set Profile>>Setuser info)

[ASP.Net]   

    http://jims57.blog.163.com/blog/static/9513617201023111112811/ //>>GetUser>>MemberShip get user>>HttpContext.Current>>Get CurrentHttpContext

 

>>SqlDataSource:

*Set SqlDataSource:(>>SetSqlDataSource)

<Asp:SqlDataSource ID="ID"runat="server"ConnectionString="<%$ConnectionStrings:BallonShopConnection%>"SelectCommand="Select [ID],[Name] from [Table1]"/>  

//ConnectionString:BallonShopConnection isset in Web.Config //SqlDataSource Connection string>>Set ConnectionString>>Set Connectionstring>>Select Command

 

>>Roles:

*Add roles:(>>Add roles)

[ASP.Net]

    {CreateUserWizard}

        http://jims57.blog.163.com/blog/static/95136172010230112438123/ //>>Senderas>>Get sender>>CreateUserWizard

       ----Remark----

        You canadd the new role manually by tool named "Web Site Administrator Tool"provided by ASP.Net.

 

>>Encrypt:(>>Encryption>>MD5>>SHA1>>DES>>3DES)

*How to Hash password:(>>How to encrypt>>Encryptpassword>>Hash Password>>Hash String>>How to hash password)

[SHA1]

    http://jims57.blog.163.com/blog/static/95136172010229115624546/  //>>ToBase64String>>ToSHA1 string

[DES]

    http://jims57.blog.163.com/blog/static/95136172010591461411/

 

*Encrypt and Decrypt:(>>How to encryptand decrypt string>>Encrypt string>>Decrypt data>>Encrypt data>>Decryptstring)

http://jims57.blog.163.com/blog/static/95136172010230104316110/ //>>Getbyte from string>>ReadToEnd>>Flush datatrin

 

>>Load:(>>PreRender>>Init)

*Load Summary:(>>LoadSummary>>PreRender Summary)

[ASP.Net]

    PreRender: Load beforeload method    

 

>>Session:

*Session Data:(>>Session Data)

---->>Set Session data----

[ASP.Net]

   Session.Add("key1","value1");

---->>Get session data----

[ASP.Net]

    Session.Contents["key1"];

 

*Get session:(>>Get Sessions)

[ASP.Net]

   {HttpContext}//>>HttpContext>>Get HttpContext Session:

       HttpContext Context=HttpContext.Current;

        objectSession=Context.Session["CartID"];

 

>>DropDownList:(>>DDL)

*DDL Items:(>>DDL Items)

---->>Add DDL items----

[JS]

    ####----Example1(Replacevalue)----####

       function ReplaceOption(Box,iNum)

        {

           var oForm=document.forms["myForm1"];

           var oBox=oForm.elements[Box];

           var oOption=new Option("苹果","Apple");//(>>JS newoption>>new options)

           oBox.option[iNum]=oOption;
        }

   

 

*DDL Type:(>>DDLType>>DropdownList type)

---->>Check ddl type----

[JS]

    ##----JS----##

       function getSelect(Box)

        {

           var oFrom=document.forms["formID"];

           var oSelectBox=oForm.elements[Box];//(>>JS getelements)

           if(oSelectBox.type=="select-one")

           {

                   //TODO;

           }

           else//When multi-selection ddl type

           {

               //TODO;

           }

        }

    

 

*How to use DDL:(>>How to useDDL>>How to use dropdownlist)

----Summary----(>>DDLSummary>>DropDownList summary)

    1.When binding thedata to DDL, it won't triger the event SelectedIndexChanged(objectsender,EventArgs e), like this.(>>Bind data to ddl>>DDL selectevent>>DDL select change event)

 

*Add item to DropDownList:(>>Add itemto dropdownlist)

    DropDownList.Items.Add(newListItem(ItemName,ItemValue)); //>>ListItems>>List Items>>AddList Items to DropDownList>>New dropdownlist item

>>Upload:

*Upload files:(>>Upload Files)

[ASP.Net]

   http://jims57.blog.163.com/blog/static/951361720102260118106/ //>>Server.MapPath>>RelativePath>>Map Path>>Upload control

 

>>Escape():

*Escape Method:(>>Escape method)

[JS](>>JS Escape method>>JSEscape() method)

---->>JS Escape example----

    Example1

 

>>Escape Characters:

[C#]

    http://jims57.blog.163.com/blog/static/95136172010361133763/

[ASP.Net]

    &   &amp; //>>&

 

>>Color:

*Good color:(>>Good colors)

      ---->>My collection color----

*System Color:(>>System Color)

[.Net]

    System.Drawing.Color.Red;

 

>>User name:(>>Username)

*Get username:(>>GetUserName>>Get user name)

[Asp.Net]

    {>>Get Username byHttpContext} (>>Get user name by HttpContext)

        stringM_StrUserName=HttpContext.Current.User.Identity.Name;//>>HttpContext>>HttpContextUser name>>HttpContext Username

 

>>Authentication:(>>Authenticated)

*Windows Authentication:(>>WindowsAuthentication)

---->>How to use WindowsAuthentication----

    ----Info----

        Info 1.

       (>>Get windows user name>>Get windows logon username>>Get windows logon name>>IdentityImpersonate>><Identity Impersonate>>Impersonate)

 

*Authenticated User:(>>AuthenticatedUser>>Logined user)

----Name Space----(>>Authenticated usernamespace>>>>Current user namespace>>usernamespace>>Logined user namespace)                       

    System.Web.HttpContext.Current.User.Identity.Name;

 

*How to use Authentication:(>>How touse authentication>>How to use Web.Config Authentication)

----Summary----(>>AuthenticationSummary)

    1.IIS priority is higherthan web.config, if you set user can access a specific page in web.config, butIIS setting is deny, system will follow IIS settings, like 

this(These part with blue background).

    2.If you set <identityimpersonate="true">, it will show the name the IIS set, like this.

----Info----

    Info 1.

 

*Forms AuthenticationNameSpace:(>>Forms Authentication Namespace>>Form AuthenticationNamespace)

    using System.Web.Security;

 

*Mixing Authentication:(>>MixingAuthentication>>windows and form authentication>>Windows and FormsAuthentication)

[.Net] (>>.Net Mixing Authentication)

    ----Summary----

        <For WinLogin.aspx>   //WinLogin.aspx means the page which is usedto check the Windows Authentication.

       1.Disable anonymous user for WinLogin.aspx at IIS.

        2.Setthe Integrated Windows Authentication. 1 and 2, see this. (>>Set windows authentication)

    ----Info----

        Info 1.

       (>>Get login Name>>Get Server loginname>>get server variable>>Get logon user name>>Get logineduser name>>Get login User name>>Server variable>>Get serverlogin name)

 

*Validate user login:(>>Validate userlogin>>Validate login>>Authenticate login>>Authenticate userlogin>>Form validation)

[ASP.Net]

----Forms Authentication---- (>>Formlogin>>Form Authentication>>Forms Login>>FormsAuthentication)

   ----Example----(>>Forms AuthenticationExamples>>FormAuthentication>>Form Authentication>>SignOut>>Redirect to login page>>Set login>>Checklogin>>Save login info to client>>Save login info tocookie>>How to use Forms Authentication)

        Example 1

        My Example 2.(>>Sign out formauthentication)

    ----Step----(>>FormsAuthentication Steps)

        1.Setredirect policy and user authorization in Web.config file,like this.(>>Web.config for FormsAuthentication>>Settings for Forms Authentication)

        2.Writethe login code for Form Authentication, like this.(>>Forms Authentication Login>>login FormsAuthentication)

 

*Check Authentication:(>>CheckAuthentication>>Check if authenticated)

[ASP.Net]

   if(HttpContext.Current.User.Identity.IsAuthenticated)//>>HttpContext>>Cureent HttpContext>>Identity>>UserAuthentication>>Check user login

    {

       ///TODO;
    }

 

*Set Admin Right:(>>Set AdminRight>>Set administrator right)

[>>Form Authentication]

    http://jims57.blog.163.com/blog/static/9513617201021742047318/

>>Performance:

*Improve performance:(>>Improveperformance>>Improve system speed>>Improve Website speed)

---->>Way to improve performance----

[ASP.Net]

    1.IsPostBack:

       if(!Page.IsPostBack)//The way is used to improve it, for the page won'treload when post back.

        {

           ////TODO;

        }

    2.OutputCache:(>>Output Page Cache>>Output Cache)

       <%@OutputCache Duration="1000"VaryByParam="VariablesName"%> //Duration unit issecond,VaryByParam means change the cache by incoming variables.

3.http://www.exam8.com/lunwen/jisuanji/yingyong/200903/1249901.html

       4.UseGZip to compress the size of ASP.Net.

              //http://apps.hi.baidu.com/share/detail/5312490

              //http://tech.it168.com/a2010/0510/884/000000884316_1.shtml

              //http://www.cainiansong.com/post/365.html//(>>How to use GZIP>>GZIp improve asp.net)

       5.Tryto use less Server Control.

       6.Useless try-catch, which will sacrifice the performance.

       7.DisableViewState of Control if possible.

[SQL Server]

    1.Do not use * whenselect.

 

>>Soundex(>>Alike Words):

*How to use soundex:(>>Get the likewords>>Search for alike words>>Search for like word>>Findalike words)

[SQL]

    Select@soundWord=soundex(@Word);//The soundex will search for those words which isthe same by pronunciation, the method is not very fast.

 

>>Validate:(>>Validation)

*Input validatation:(>>Validate inputcontent>>Input validation>>Validation control>>Controlvalidation>>Validate control)

[ASP.Net]

       1.<asp:requiredfieldvalidatorid="LogonNameRequiredFieldValidator" runat="server"controlToValidate="LogonNameTextBox"

errormessage="用户名必须填写 "display="Dynamic">*</asp:requiredfieldvalidator>

       2.<asp:validationsummary id="LogonValidationSummary"runat="server" HeaderText="请正确填写您的用户名及密码"></asp:validationsummary>

       //>>Validation summary

 

*Button Validation:(>>Button Validation>>Validateby Button>>Button Validation Event)

[ASP.Net]

    <Asp:ButtonID="Button" runat="server"CausesValidation="true" CommandName="Update"Text="Update"/>  //>>Button Event>>Button Command

 

>>Page:

*Page Event:(>>Page Event>>PagingEvent)

---->>Change page indexevent----(>>Change page event)

    [ASP.Net]

       ----ASPxGridView----(>>ASPxGridView change pageevent>>ASPxGridView page event)

          Example 1.

 

*Redirect Page:(>>Redirect page)

[JS](>>JS redirectpage>>Javascript redirect page)

    ----Example----

        My Example 1.

 

*Validate Page:(>>Validatepage>>Page validation>>Valid Page)

if(Page.IsValid)

{

    ////TODO;
}

 

*Get current page:(>>Get current pagepath>>Get page current path)

[ASP.Net]

stringM_StrPage=Request.AppRelativeCurrentExecutionFilePath; //Return string formatas "~/Index.aspx" >>Get relative path>>Request>>Getpath

if(String.Compare(M_StrPage,"~/Index.aspx",true)==0)//true means the comparation ignore the case-sensitive. (>>Comparestring>>Get root path>>Root Path)

{

    ////TODO;
}

 

>>ScriptManger:(>>Scripmanager>>Page.ClientScript>>Set Script)

*How to use Script Manager:(>>How touse script manager)

[ASP.Net]

http://jims57.blog.163.com/blog/static/951361720102171943323/

*Tie the TextBox to Button:(>>TieTextBox to Button>>Link TextBox to Button>>LinkButton>>TieButton>>Tie Button>>Link textbox and button)

http://jims57.blog.163.com/blog/static/9513617201021713621619/

 

>>Replace:

*How to use replace:(>>How to usereplace)

[C#]

    usingSystem.Text.RegularExpressions; //You have refer to the namespacefirst.(>>Regex namespace)

    string Str=" abck  d d   "";

   Str=Regex.Replace(Str," ","*");//return like this. (>>How to use Regex Replace)

[SQL]

   replace(@Sentence,@WordToBeReplace,@WordToReplace)//The method"Replace"  is internal one so it is very very fast to perform.

 

>>NameValueCollection:

*How to use NameValueCollection:

http://jims57.blog.163.com/blog/static/9513617201021655959579/(Mustadd namespace using System.Collections.Specialized)

>>Encoding:

*Set the global encoding:(>>GlobalEncoding>>Set Global Encoding)

[Web.Config]

    <globalizationrequestEncoding="utf-8" responseEncoding="utf-8"culture="en-us"/> //Set all the user in different time zone showthe same encoding(same text format)

>>Eval:

*Eval Format:(>>Eval Format)

[ASP.Net]

   <span><%#Eval("Price","{0:c}")%></span>

 

*Eval():(>>Eval method)

[JS](>>Javascript Eval()>>JSEval())

---->>JS Eval Example----

alert("2+3");//return:"2+3"

alert(eval("2+3"));//return:5

----Summary----(>>Eval summary>>JSeval summary)

    1.You can change the string into theJSON object directly, by "varp=eval("("+JSON_text+")")".

>>Alignment:

*How to use alignment:

[Html]

    <tdvAlign="top" width="250"></td> //(>>VAlign)

 

>>Bind Data:

*How to bind data to control:(>>BindControl Data>>Bind data to control>>How to bind data tocontrol>>Eval>>DataBind())

http://jims57.blog.163.com/blog/static/9513617201021644556549/edit/ (>>Binddropdownlist data>>Bind DDL data>)

>>Request.QueryString:

*How to use Request.QueryString(>>Howto use Request.QueryString>>Get Variables>>Get variablesvalue>>Get Variable Value):

[ASP.Net]

    1.stringM_Str=Request.QueryString["Variables"];

    2.Request.Form["TextBox1"];

 

>>Enumeration:(>>Enumeration)

*How to use Enumeration:(>>How to useenumeration)

    http://jims57.blog.163.com/blog/static/951361720103605521308/

 

>>Struct:

*How to use struct:(>>How to usestruct)

[C#]

http://blog.163.com/prevBlogPerma.do?host=jims57&srl=9513617201021631247169&mode=prev

>>Type:

*Type Transferation:(>>TypeConvert>>Convert Type>>Type Transferation>>TryParse)

[C#]

   Int32.Parse(ConfigurationManager.AppSettings["MyID"]);//>>ConfigurationManager>>ConfigurationManager

    Decimal.Parse(AVaribles);

   Byte.Parse(variable);//>>Bype.Parse

    Double.Parse(DataRow["Name"].ToString());>>DataRow>>Get DataRow value by name

    IPAddress ipaddress =IPAddress.Parse("127.0.0.1"); //(>>Convert string into IPadress>>IPAddress>>IP address>>Convert to IPaddress>>Convert string to IP address)

    Example 1.(>>Convert DNS to IP address>>DNSto IP address)

[JS]

   iWeek=parseInt(prompt("Please input thenumber."));//>>Convert string to number

   iNumber=Number(prompt("Please your number"));//>>Convertstring to number

[SQL]

    Str('123') //reutn 123 asint, convet string to int

   Convert(CONVERT(data_type,expression[,style])) , see info.//(>>How to use sql convert)

    cast(10.234 as int)//return 10.Cast means convert a type to into type, this example mean,converting "float type" to int. Format: cast(Field as SqlType)

    CAST('2008-10-16 10:41:19'AS datetime)  //return datetime from string format 

 

*Type Summary:(>>Type Summary)

----Info----(>>Type Info)

    Info1 (>>Int scope>>Bigint scope)

    Info2

----Remark----(>>Type Remark)

    1.Char will be better thanVarChar, if you want the specific length of the characters

[SQL] (>>SQL Type>>SQLDBType>>SQL DB Type>>DBType.Ansistring)

---->>SQL Type----

    DBType.AnsiString; //Thistype is used to transfer long variables, like product description.(DbType.String <=4000 Unicode chars)

---->>SQL TypeSummary----(>>>>char and varchar)

    1.Char(2): You caninput 2 Englishletters or 1 Chinese l char.

    2.NChar(2):2 Englishletters or 2 Chinese chars.

    3.SmallInt(-32,768 -32,767), TingInt(0-255)

 

>>Variable:

*Set Variables:(>>Set Variables)

[SQL]
    Select@Word2=Replace(@Sentence,@WordToBeReplaced,@WordToReplace)    

 

*Use variable in SQL(>>Use stroredprocedure variables>>Stored Procedure Variables):

[SQL 2008 StoreProcedure]    

    http://jims57.blog.163.com/blog/static/95136172009101201832681/edit/?mode=prev  


>>Table:

*Delete Table:(>>Delete Tables)

[SQL] (>>Delete sql table>>Dropsql table)

    Drop Table Table1//All the indexes and data in the Table1 will be deleted, and View basedon the table1 can not be referenced even the View is notdeleted

[Oracle] (>>Oracle deletetable>>Truncate table>>Oracle truncate table)

    Truncate Table //You haveto use the truncate table, not just delete table or droptable something like that, please see this.

*Create Table:(>>Create Table)

[SQL] (>>Create sql table>>CreateSQL Table Variables)

----Example----

    Example 1.

 

>>Paging:(>>Page)

*How to use SQL paging(>>How to usepaging>>Get paging>>SQL Paging):

----Info----

[SQL 2000&2005]    (SQL2000 Paging>>SQL 2005 paging)

    Example 1 .(>>Row_Number()>>SQL Tablevariables>>Table Variables>>Create Tempory 

Table>>Create temp table>>Declaretable>>Define table)

[Oracle] (>>Oracle paging)

    Example 2. (Info1)

----My Practice----

    [SQL Server 2000]

    Practice 1 (>>Output SQLparameters>>Output SQL variables>>Create SQL temptable>>Create sql temporary table>>SQL mode>>SQLdivision>>Define SQL variables>>Set sql variables)

 

>>Ritht():(>>Left()>>Mid())

*Right, Left and Mid method 

[C#]

http://jims57.blog.163.com/blog/static/9513617201021553341451/   (>>C#Right()>>C# Left()>>C# Mid())

 

>>Template Language:

*How to use template language Freemaker(Forjava):

http://freemarker.sourceforge.net/

>>HTML

*Inner Html:(>>InnerHtml>>Innerhtml)

---->>Get InnerHtml----

[JQuery|JS]

    Example //(>>Set div innerhtml>>Get divinnerhtml)

 

*Html Controls:(>>Html controls)

[Html]

    {downdroplist}(>>html dropdownlistcontrols)

 

*Encode Html:(>>EncodeHtml>>HtmlEncode>>Html Encode)

    1.stringM_StrEncodedHtml=Server.HtmlEncode(M_StrWithHtml);

   2.Server.UrlEncode("UrlString");//Encode url, likeDefault.aspx?name+Name

 

*Decode Html

 

*Convert ASP.net into HTML(>>CreateHTML>>Convert ASP.net into HTML>>Convert ASP.net to HTML)

http://jims57.blog.163.com/blog/static/951361720102845554794/edit/

>>iFrame:

*How to use iFrame:   

    http://jims57.blog.163.com/blog/static/951361720102810939139/

 

>>Play by turns(>>AD Play byturns):

[Flash] (>>Flash Play byturns>>Flash AD play by turns>>Rotate Flash>>Rotated Flash)

   https://docs.google.com/uc?id=0Bz23VoSTWyf3ZWU5OTIzMTAtZThjNC00ZmFmLWJiZWMtYzU2YjE5ODRlMmM5&export=download&hl=en (>>Providedby Jacob)   

 

>>Alipay:

*How to use Alipay(>>How to usealipay>>Alipay class>>Alipay interface routine>>Alipay port):

http://jims57.blog.163.com/blog/static/9513617201012684945380/

>>Declare:

[SQL]

    Declare SQLTable(>>Declare SQL Table>>Declare @table):

http://jims57.blog.163.com/blog/static/95136172009112951659109/edit/?mode=prev

 

>>Data:

*Import Data Problem:(>>Import DataProblem)

[SQL Server]

----Problem 1----(>>Import excel 2003to SQL server>>Import Data from Excel into SQL Server)[Number can notimport as text]

http://jims57.blog.163.com/blog/static/95136172009111663425836/edit/

 

>>While:

*While true format(>>While trueformat>>While(true)>>While loop):

While(true)

{

    if(Validation==true)break;//Itmust has the break to exit the loop

}

 

>>HTTP:

*How to use Http Object:(>>How to useHttp Object>>How to Use Http Class>>Use Http Object)

http://jims57.blog.163.com/blog/static/95136172009101911657507/edit/?mode=prev

---->>HttpObj Summary----(>>HttpObject Summary>>Http Obj summary)

    Summary1

 

*HTTP Class(>>HTTP Class>>HTTPObjClass>>Http Object):

----Class 1----

http://jims57.blog.163.com/blog/static/95136172009101311427660/edit/?mode=prev

 

>>DBManager(>>DB CommonClass>>DB Class):

----Class 1----

http://jims57.blog.163.com/blog/static/951361720091013113935678/edit/?mode=prev

 

>>Switch:

*Switch format(>>Switch format):

----Example 1----

http://jims57.blog.163.com/blog/static/95136172009101311238484/edit/?mode=prev

 

>>Thread(>>Threading): 

*Thread Join:(>>ThreadJoin>>Thread.Join())

ThreadA.Join();//The thread B will notexecute until Thread A finish;

----Example----

 

*How to use Thread(>>How to useThread>>Use Thread>>how to use threading):

[C#]

    [Without ParameterMethod](>>Use Thread without Parameter>>Createthreading)         

    http://jims57.blog.163.com/blog/static/95136172009101433036741/edit/?mode=prev [Havebeen practised by me]

    [With ParameterMethod](>>Use Thread with Parameter)

    http://jims57.blog.163.com/blog/static/95136172009101433222734/edit/?mode=prev [Donot practise it as well]

 

*Control Control acrossThreading(>>access between thread>>Across thread>>accesscontrols across threads>>Control control across threading>>Accessto control across threading>>Update Control by Threading>>thread acrossaccess>>across threads access>>across thread access)

----Summary----

    For Exampl 2.

        (1).

----My Example----

http://jims57.blog.163.com/blog/static/951361720102154335051/edit/

----Example----  

    Example 1.

    Example 2.

    Exampe 3

 

*Thread Method(>>Thread Method):

http://jims57.blog.163.com/blog/static/95136172009101484134928/edit/?mode=prev 

 

*Thread Property(>>ThreadProperty>>Thread Properties):

http://jims57.blog.163.com/blog/static/9513617200910148429469/edit/?mode=prev

 

*Thread ThreadStateProperties(>ThreadState Properties>>ThreadStateProperty>>Threading State>>Thread State):

http://jims57.blog.163.com/blog/static/95136172009101484353656/edit/?mode=prev

 

>>Delegate(>>Asynchronization>>Asynchronisation):

*Delegate Summary:(>>Delegate summary)

    1.When multi-pointing tocall the delegate, you MUST make sure all methods return typeare void.

    2.When multi-pointing tocall the delegate, DO NOT use "Out"type argument list.

    3.The methods the delegateis going to call can be the normal method or static method.

    4.Delegate CAN NOT be derived by another class.(Delegate is Sealed)

 

*Create Delegate(>>Create Delegate>>UseDelegrate>>How to use delegate)

----Summary----(>>Delegate and eventsummary>>Delegate summary)

    1.For delegate and eventexample(example4):

       (1). Event and delegate have to thesame reference, like "PlayGame" in 小张 class, and "PlayGameHandler" in thisexample 4

       (2).Event definition, like "public event PlayGameHandler PlayGame", have to be done in event activator, 小张 class.

       (3).Event achievement, like "PlayGame(this,e)", have tobe in a function,"protected virtual void onPlayGame(EventArgs e)"

        (4).Thedelegate with Event, the instantiation of delegate will be transferred toEvent,like "z.PlayGame+=new PlayGameHandler(w.扣钱);"

        (5).Ifyou want to use the event without += or -=,you have to use it in the same class, event the child classcan not use it if the event definition is in father class(orabstract class), like this.

----Step----(>>Call one method bydelegate)

代理三步曲:
a.生成自定义代理类:delegate int MyDelegate(string Name);//Thissentence must be outside any of the class.(>>New delegate)
b
.然后实例化代理类:MyDelegate d = newMyDelegate(MyClass.MyMethod);//Both the static class and instantiated objectcan be add here.return value must be the same as the function it will use.
c
.最后通过实例对象调用方法:int ret =d(NameValue); 

----Example 2----(>>Call many methodsby delegate>>Multi-Point call methods by delegate>>Multi Point tocall delegate>>Mulit-point to call delegate)

    http://jims57.blog.163.com/blog/static/9513617201031063910872/

----Example 3----

http://jims57.blog.163.com/blog/static/9513617200992911646566/edit/?mode=prev

----Example 3-----

http://jims57.blog.163.com/blog/static/951361720099293850185/edit/?mode=prev

   Example 4. //Goodexample about delegate (>>Delegate and Event)

   Example 5 //(>>MyDelegate and event examples>>how to use delegate and event)

   Example 6.

   My Example 7

   My Example 8 (>>Mouse and catexample>>Mouse and cat delegate and event)

----FYI----

http://jims57.blog.163.com/blog/static/951361720099290557214/edit/?mode=prev

----Info----

     

>>SMS:

*Send Google SMS by Calendar(>>GoogleSMS>>Send SMS by Google>>Send Google SMS>>Send GoogleCalendar SMS):

http://jims57.blog.163.com/blog/static/95136172009817113242743/edit/?mode=prev

 

*SMS API:

[Fetion]

     http://www.libfetion.cn/

 

>>ViewState:

*ViewState NameSpace(>>ViewStateNameSpace)

using System.Web.UI.StateBag;// It use"Name-Value" way to save the Viewstate

 

*Decode ViewState:(>>Decode ViewSate)

----Way 1----

    http://www.wilsondotnet.com/demos/viewstate.aspx  //Usethe website to decode

 

*ExtractViewState(>>Extract ViewState>>GetViewState)

----Way 1----HoHof

http://jims57.blog.163.com/blog/static/95136172009816307998/edit/?mode=prev

----Way 2----

http://blog.163.com/jims57/blog/static/95136172009816273360

 

>>EventValidation:

*Get EventValidation(>>GetEventValidation>>Extract EventValidation):

----Way 1----

http://jims57.blog.163.com/blog/static/9513617201001311416356/edit/

http://blog.163.com/jims57/blog/static/95136172009816273360

 

>>Cookies:

*Disable Cookies:(>>Disable Cookies)

[ASP.Net]

    http://jims57.blog.163.com/blog/static/9513617201022853242492/

 

*Get Cookies:(>>Get Cookies)

[ASP.Net]

    {HttpContext}(>>GetHttpContext Cookies)

       HttpContext.Request.Cookies["CartID"];

    

*Add Cookies:(>>Add Cookies)

   http://jims57.blog.163.com/blog/static/9513617201022824617658/ //>>SetCookies>>Set Session>>AddSession>>TimeSpan>>HttpContext>>Session>>Cookies>>AddDateTime

    

 

>>CookieContainer:

*Get CookieContainer(>>GetCookieContainer):

using System.IO;

using System.Net;

       public static System.Net.CookieContainer GetCookieContainer(string logUrl,byte[] data)
        {
           HttpWebRequest request = HttpWebRequest.Create(logUrl) as HttpWebRequest;
           request.AllowAutoRedirect = false;//
禁止自动重定向
           request.Method = "Post"; //
使用post方法
           request.ContentType = "application/x-www-form-urlencoded";//form
提交时使用urlencode
           request.ContentLength = data.Length;
           request.CookieContainer = new CookieContainer();
            StreamuploadStream = request.GetRequestStream();
            uploadStream.Write(data,0, data.Length);
           uploadStream.Close();
           HttpWebResponse resposne = request.GetResponse() as HttpWebResponse;
           resposne.Close();
            returnrequest.CookieContainer;//
反会获取的cookieContainer
        }

 

>>ToolStripMenuItem(>>ContextMenu>>ContextMenu):

*Create Context Menu dynamic(>>CreateContext Menu>>Dynamic Create Context Menu>>CreateToolStripMenuItem):

----Way 1----

 ToolStripMenuItem item = newToolStripMenuItem("动态菜单Text",null,new System.EventHandler(this.DynMenuItem_Click),"menuItemName");

//Format is(Name,Text,Handler,ShoutCut)

----Way 2----

                               ToolStripMenuItem mItem;
                               mItem = new ToolStripMenuItem(ds.Tables["table_1"].Rows[i]["FMenuText"].ToString());
                               mItem.Name = ds.Tables["table_1"].Rows[i]["FMenuName"].ToString();
                               mItem.Text = ds.Tables["table_1"].Rows[i]["FMenuText"].ToString();
                               mMain.Items.Add(mItem);

----Way 3----(>>ToolStripMenuItemEvent>>ToolStripMenuItem Handler)

 1.         private void Tmi_Click(object sender, EventArgs e)
        {
            stringM_Str=((ToolStripMenuItem)sender).Tag.ToString();
           MessageBox.Show("Current text is "+M_Str);
        }

//Add a event

2.

           DataTable M_DT =Biz.GroupManager.DBAccess.GetAllGroupInfoWhichHaveRightToControlSupportGroup(M_IntUserID);

           foreach(DataRow M_Dtr in M_DT.Rows)
            {
               M_StrItemText = M_Dtr["Name"].ToString();
               M_TmiItem = new ToolStripMenuItem(M_StrItemText,null,this.Tmi_Click);
               M_TmiItem.Tag = M_Dtr["ID"].ToString();
               this.TmiAssignToGroup.DropDownItems.Add(M_TmiItem);
            }

//Add object and set the drop down list for aToolStripMenuItem.

----Way 4----

       private bool CreateChildTmis(ToolStripMenuItem M_TmiParentTmi,DataTable M_DT,string M_StrFieldNameForText, string M_StrFieldNameForTag,System.EventHandlerM_EhdHandlerName)
        {
            //Variables
            boolM_BlnIsSuccess = false;

           try
            {
               int M_IntUserID = Biz.SupportManager.Entity.G_IntUserID;
               ToolStripMenuItem M_TmiItem;
               string M_StrItemText = string.Empty;

               if (M_DT.Rows.Count == 0) return false;

               foreach (DataRow M_Dtr in M_DT.Rows)
               {
                   M_StrItemText = M_Dtr[M_StrFieldNameForText].ToString();
                   if (M_EhdHandlerName!=null)
                   {
                       M_TmiItem = new ToolStripMenuItem(M_StrItemText, null, M_EhdHandlerName);
                   }
                   else
                   {
                       M_TmiItem = new ToolStripMenuItem(M_StrItemText);
                   }
                   M_TmiItem.Tag = M_Dtr[M_StrFieldNameForTag].ToString();
                   M_TmiParentTmi.DropDownItems.Add(M_TmiItem);
               }
               M_BlnIsSuccess = true;
            }
            catch
            {
               M_BlnIsSuccess = false;
            }

           return M_BlnIsSuccess;
        }

 

----Summay----(>>ToolStripMenuItemSummary>>Context Menu Summary)

               //将菜单加到顶层菜单下。
               topMenu.DropDownItems.Add(subMenu);

 

*ToolStripMenuItem Event:(>>ContextMenuHandler>>Context Menu event>>Add Context Menu Event>>AddContext Menu Handler>>ToolStripMenuItem Event):

----Add Handler----

1.subMenu.Click += new EventHandler(Tmi_Click);

2.M_TmiItem = newToolStripMenuItem(M_StrItemText,null,this.Tmi_Click);

----Handler----(>>TmiTag>>ToolStripMenuItem Tag)

       private void Tmi_Click(object sender, EventArgs e)
        {
            string M_Str= ((ToolStripMenuItem)sender).Tag.ToString();//>>Get Tmi Tag
           ShowConfirmInfo("Are you sure to do theaction?");            
        }

 

>>Group By:

*Group By Summary:(>>GroupBySummary>>Group By Summary)

[SQL] (>>SQL Group bysummary>>SQL Groupby Summary)

    1. When group by"Case when",you should have the field "casewhen",like this.

    2.Have to have the"Aggregate function", like this.//Aggregate function includes"AVG","Count","Sum" etc.

    3.You can combine morethan 1 field as a field to group by, like this.

    4.When you group by morethan 1 fields, all the field name which is grouped by have to be written inselect sentence, like this.

 

*Group by many field(>>Group by manyfields>>Group by multi fields):

----Example----(>>Group by many fieldsexamples)

Example 1: selectAccountID,Year(YearField),sum(Money)  from table1 group byAccountID,Year(YearField)//It will group by AccoutID and YearField 

Example 2. (>>Combine fields to groupby>>Group by combined fields)

 

*Group by format:(>>Group by Format)

SELECT Customer,OrderDate,SUM(OrderPrice)FROM Orders GROUP BY Customer,OrderDate //The customer and OrderDate after Groupby must must the field "Customer" and "OrderDate"

 

>>Substring:

*How to use  substring:(>>Getsub string)

[SQL]

substring(str,x,y): <str>中的第x位置开始,选出接下去的y个字元。//Xindex begin as 1.Example: substring(Description,1,@DesLen), index begin as 1.

[C#] (>>C# Substring)

---->>How to use C# Substring()----

 String.Substring(int   index,int  length)   
  index:Begin from 0     
  length: The length you want   

    ----Example----

        Example 1.

 

>>With As: (With as's performance isbetter and use temporary table, like "create table tablename" and"Declare @Tablename table", use it when possible.)

*How to use With As(>>How to use WithAs>>With As format>>How to use SQL with as):

[SQL] (>>SQL With As)

---->>With as Format----(>>SQLwith as format)

With TempTable1 as (select * from table1)//TempTable1 is the temporary table created by With As (>>SQL temporarytable)

     , //Must addthe comma here

TempTable2 as (select * from table2) 

---->>With As Example----(>>SQLwith as examples)

    Example 1. 

 

>>Duplicate Rows:

*Delete the duplicate rows inSQL(>>Delete Duplicate Rows):

[SQL server] (>>With as>>SQL WithAs)

With Temp as (select Row_Number() over(orderby Name) as RN,* from tb_Test)
delete from Temp where Temp.RN in 
(select a.RN from Temp a,Temp b where a.RN>b.RN and a.Name=b.Name)//Must use"With" to record a related, it can not use " (select * fromtable) temp" to delete the records.

[Oracle]

 delete from T where rowid in
(select a.rowid from T a,T b where a.rowid>b.rowid and a.id=b.id)//rowid isthe internal function of Oracle.

 

>>Union:

*How to use Union(>>How to useUnion>>Union and order by):

http://jims57.blog.163.com/blog/static/9513617200911281041548/edit/?mode=prev

 

>>SqlParameter:

*Output SqlParamter:(>>OutputSqlParameter>>Out SqlParameter>>SQL OutputSqlParameters>>Output Variables)

[C#]

   SqlParameter.Direction=SqlParamterDirection.Output; //Set outputparameter>>Set output variables>>Output SqlParameter>>Outputparameter

[SQL] (>>output sql variables)

 

*How to use SqlParameter:(>>How to usesqlparameter>>use SqlParameter)

http://jims57.blog.163.com/blog/static/951361720091124114028907/edit/?mode=prev

 

*Get SQLParamter(>>GetSQLParameter  by program>>Get SqlParameter value andType>>GetSqlPatameters):

http://jims57.blog.163.com/blog/static/95136172009102651253186/edit/?mode=prev

 

*Loop to add SqlParameter(>>Loop to addSqlParameter>>Loop to add Parameter>>Loop to get SqlParameter):

http://jims57.blog.163.com/blog/static/951361720091120133044/edit/?mode=prev

http://jims57.blog.163.com/blog/static/9513617200911301459979/edit/?mode=prev

  

>>If else(>>If else):

*How to use SQL if else(>>How to useSQL if else>>SQL IF ELSE):

----Way 1----

IF (SELECT * FROM T1 WHERE DEA005 = '05')
    BEGIN
        SELECT * FROM T1 WHEREDEA005 = '05'
    END 

ELSE 

    BEGIN
    SELECT * FROM T1 WHERE DEA005 <> '05'//Else can be: begin and end as well.

    END

----Way 2----(>>Check sqlvariables>>Check null>>Check variable null)

[SQL]

if @Variable is null

    begin

        select* from table1

    end

[C#]    

    ----DataReader----

     if(M_DR[(string)M_ArlFields[M_IntI]] is DBNull)//If it is the DBNull>>CheckDR null>>Check DataReader null>>Check SqlDataReader Null

    {

        M_StrTempFieldValue = "";

    }

   ----String----(>>Check C# empty>>Check C# null)

   if(String.IsNullOrEmpty(txtUserName.Text)){//TODO;}

[SqlParameter]

   if(SqlParameter.IsNullable)//>>Check SqlParameter null

    {

       ////TODO;

    }

 

 

>>Alias:

*Summary:

[SQL]

1.Can not use the alias to set value.e.g:

select T1.ID CaseID,Name from table1 T1 wheretable1.ID=T1.CaseID//It can not use alias like T1.CaseID to set value, itshould use T1.ID to set.

 

>>Top 1(>>SQL Top1>>Set value by top 1):

*Set the value by top 1:

Select top 1 @userID =ID from table1

 

*SQL Top info:(>>Top 100 percent)

Select * from (select top 100 percent fromtable1 where ID=1 order by Name) //In subquery, if you need to use "Orderby", you must use "Top", like this.

 

>>Day of week:(>>Week days)

*Today week day:(>>Today week day)

---->>Get today week day----

   System.DateTime.ToDay.DayOfWeek.ToString();//Return Money

 

>>DateDiff(SQL DateDiff):

*How to use DateDiff(>>How to useDateDiff):

DATEDIFF ( datepart , startdate , enddate) 
参数

datepart

是规定了应在日期的哪一部分计算差额的参数。下表列出了 Microsoft® SQL Server™ 识别的日期部分和缩写。日期部分 缩写
year yy, yyyy
quarter qq, q
Month mm, m
dayofyear dy, y
Day dd, d
Week wk, ww
Hour hh
minute mi, n
second ss, s
millisecond ms

----Example----

    select CartID,Min(DateDiff(dd,DateAdded,GetDate())) from ShoppingCart group by CartID//>>DateDiff>>Min>>Group By>>GetDate()

 

>>Email:

*Send Email:(>>Send Email byC#>>SmtpClient)

using System.Web.Mail;//The namespace must beincluded in the class,or using System.Net.Mail;

SmtpClient SC=new StmpClient("SMTP IPaddress");//You can use the local SMTP server which should be installed inIIS, or external SMTP server like 163

MailMessage MM=newMailMessage("from","to","subject","body"); 

SC.Send(MailMessage);

 

>>Order By(>>OrderBy):

*Order by without duplicaterows(>>Order by without duplicate rows>>Order by AgentCount):

http://jims57.blog.163.com/blog/static/951361720091128114139864/edit/?mode=prev (Discussedwith SSX and PHC on 2009-12-28)


*Customize order by search(>>Customize order by search>>Customizedorder by):
[SQL server]

 

select * from T 
order by CHARINDEX('|' + LTRIM(RTRIM(STR(Id))) + '|', '|3|4|5|1|') desc //(>>SQL Trim)
**********************************
返回字符串中指定表达式的起始位置。 
**********************************

>>Hashtable:

*How  to use Hashtable(>>How to use Hashtable>>How to use Hashtable):

 http://jims57.blog.163.com/blog/static/95136172009102481758998/edit/?mode=prev

 

*Hashtable namespace(>>HashtableNamespace):

using System.Collections;

 

>>DictionaryEntry:

*How to use DictionaryEntry(>>How touse DictionaryEntry):

http://jims57.blog.163.com/blog/static/95136172009102645920927/edit/?mode=prev

 

>>If Exists(>>IfExists>>SQL Exists>>SQL Not Exists):

*How to use If Exists(>>How to use IfExists):

if exists(select * from table1)//Or if notexists(select * from table1)

    begin

    ----Content----

    end

else

    begin

    ----Content for otheraction----

    end

//When exists, do the content

 

>>Trigger:

*How to use the trigger in SQL server2000(>>How to use Trigger in SQL server 2000>>Use SQL 2000Trigger>>Use SQL server 2000 Trigger):

[SQL server 2000]

ALTER trigger [dispatcher].[Trig_AddWorkLogWhenAddCaseInfo]on [dispatcher].[tb_CaseInfo] for insert
AS 
BEGIN
insert into tb_WorkLog(CaseID,UserID) select inserted.ID,inserted.UserID frominserted

END

//-----It can not use as insert intotable1(ID) values (select inserted.ID from inserted). but SQL server 2008 canuse with values in trigger.-----

//-----In SQL server, it has to use"Select inserted.ID from inserted" format to set the value ofvariable,like update tb_CaseInfo set tb_CaseInfo.ActionUserID=(selectinserted.UserID from inserted) where tb_CaseInfo.ID=(select inserted.CaseIDfrom Inserted)

 

*Trigger format(>>Trigger Format):

Insert, update: use inserted as the temporarytable

delete: use deleted as the temporary table

 

>>ComboBox(>>Combo Box):

*Set ComboBox Text And Value:(>>SetValue And Text For ComboBox>>Set ComboBox Text And Value)

http://jims57.blog.163.com/blog/static/95136172009112311565281/edit/?mode=prev

 

*Select ComboBox item by text(>>selectcomboBox item by text>>Select ComboBox Value And Text ByText>>Select ComboBox by Text)

http://jims57.blog.163.com/blog/static/95136172009112950771/edit/?mode=prev 

 

*ComboBox Event(>>ComboBox Event):

[Select Item](>>Select ComboBox IndexEvent>>Select ComboBox Event)

http://jims57.blog.163.com/blog/static/9513617200911230425417/edit/?mode=prev

 

*Set Child ComboBox(>>Set ChildComboBox>>set child comboBox>>Set comboBox child value and text):

http://jims57.blog.163.com/blog/static/9513617200911230157384/edit/?mode=prev

 

*ComboxBox Name Space(>>Comboboxnamespace>>Combobox name space>>Control Name space>>ControlNamespace):

using System.Windows.Forms;

 

*Set ComboBox Value and Text byDataTable:(>>Set ComboBox Value and Text>>Set Combox Text andValue)

http://jims57.blog.163.com/blog/static/95136172009101295837703/edit/?mode=prev

 

*About SelectedText ofComboBox(>>SelectedText>>ComboBox SelectedText>>Combo BoxSelectedText>>ComoBox Style>>ComboBox list type):

如果 DropDownStyle 设置为 DropDownList,则返回值是空字符串 ("")

 

*Get the current text of ComboBox(>>Getdropdownlist current text>>Get comboBox selected text>>Combo BoxText>>ComboBox Text>>Get the current text of ComboBox>>GetComboBox current Text>>Get ComboBox Text>>Combobox selecttext>>get ddl current text>>dropdownlist currenttext>>ComboBox Current Text>>DDL current text>>DDL SelectedText):

[WinForm]

 this.CbxCompany.Text;//The text is thecurrent selected text

[WebForm]

this.Ddl.SelectedItem.Text; //DropDownListcontrol

 

*Get ComboBox Selected value(>>GetcomboBox selected value>>Get combobox value)

[C#]

ComboBox.SelectedValue.ToString().Trim();//>>Dropdownlistselected value>>DDL current value>>ComboBox Current value

[ASP.Net]

   DropdownList.SelectedItem.Value;

 

>>Byte:

*Get Byte from string:(>>Get byte fromstring>>Get Bytes from string)

[C#]

    byte[] btContent =Encoding.GetEncoding("gb2312").GetBytes(strContent);//>>GetBytes>>GetEncoding>>Encoding

 

>>String:

 

*Delete String:(>>Delete string)

[ASP.Net]

    1.StringBuilder sb=newStringBuilder("Heeeello"); sb.Re

 

*Connect string:(>>Connectstring>>Join String)

[ASP.Net]

    1.string M_Str=String.Concat("Hello","","World");//Return "Hello World"

    2.String[]M_StrArray={"Hello","World"};

        stringM_Str=String.Join("**",M_StrArray);//Return "Hello**World"."**" is the delimiter

 

*Check startwith string:(>>CheckStartwith string>>Startwith string>>Check endwithstring>>Endwith string)

[ASP.Net]

    boolb1="Hello".StartsWith("He");//Return "true"

    boolb2="Hello".EndsWith("llo");//Return "true"

[SQL] (>>sql startwith)

    select * from tb_Test whereName like '%' //It will search out all the user with surname ""

 

*Compare string:(>>Compare string)

[ASP.net]

    1.boolb1=String.Compare(StrA,StrB);//StrA="Hello",StrB="World",so return -1.The return value can be {-1,0,1}

    2.System.StringStrA="Hello";        

        boolb1=StrA.CompareTo(StrB);//Return -1,if StrB="World".CompareTois Case-Sensitive method.(>>CompareTo>>Compare To)

 

*Get String from Byte:(>>Get Stringfrom byte)                

               string strInfo = Encoding.GetEncoding("gb2312").GetString(bytes,0, bytes.Length);

               //bytes is a variable which recordbyte.>>GetString()>>GetEncoding>>Encoding>>Gb2312

*String Array:(>>String Array)

----Set String array----(>>Set Stringarray>>String array>>New string array)

[1 D String array]

1.string[]M_Strs={"a","b"};//Do not use string[] M_Strs=newstring{"a","b"};

2.String[] M_StrStr2=newString[2]{"A","B"};

----Foreach string array----

    string[]names={"a","b","c"};

    foreach(string s in names)

    {

        ///TODO;  }

[2 D String Array] (>>2D stringArray>>2 D array>>2 D string array)

---->>Declare 2 D array----

    int[,]=new int[2,2];

 

*String Builder:(>>How to use stringbuilder>>How to use stringbuilder>>String Builder)

http://jims57.blog.163.com/blog/static/95136172010230111623796/

*String Format:(>>StringFormat>>How to use string format)

[ASP.Net]

    1.<a id=RoomCategoryManLinkhref="<%=RoomCategoryManLink%>">房间类型管理 </a> //<%%> is to set the hrefwith variable from server.

[C#]

    1.<ASP:LabelID="ID" runat="server"Text='<%#String.Format("{0:0.00}",Eval("Price"))%>'></ASP:Label> //>>Bind Data>>Eval>>String.Format

   2.Label.Text=String.Format("{0:c}",amount);//c means the formatwill be currency one.>>Money Format>>Money String Format

    3.<Asp:BoundFieldDataField="Money" DataFormatSring="{0:c}"HeaderText="Subtotal" ReadOnly="true"SortExpression="Subtotal"> //this is in GridView <Columns>>>ReadOnly>>BoundField>>HeaderText

 

*Segment String Class(>>Segment StringClass):

http://blog.163.com/jims57/blog/static/951361720091024103518389

 

*How to use Split(>>Split>>How touse Split>>Split string):

[C#]

string[] M_StrCookies =M_StrCookie.Split(';');

[JS] (>>JS split>>Javascriptsplit>>How to use js split>>how to use javascript split)

    ----Example----

        My Example 1.

 

>>HttpWebRequest(>>HttpWebResponse):

*Summary about HttpWebRequest andHttpWebResponse(>>HttpWebRequest Summary>>HttpWebResponseSummary>>WebClient Summary>>WebBrowser Summary):

1.        NameValueCollectionmyNameValueCollection = new NameValueCollection();

2.        byte[]pagedata = wb.UploadValues("http://www.ip138.com:8080/search.asp",myNameValueCollection);

3.        byte[]bResponse = wc.DownloadData(uri);
string strResponse = Encoding.ASCII.GetString(bResponse);

4.        client.Headers.Add("user-agent""Mozilla/4.0(compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");

5.               WebClientwebClient = new WebClient();
        
byte[]responseData = webClient.DownloadData(uriString);
        
string srcString= Encoding.UTF8.GetString(responseData);

6.        webClient.Headers.Add("Content-Type","application/x-www-form-urlencoded");(>>Content-Type>>Content Type>>ContentType)

7.                viewState= System.Web.HttpUtility.UrlEncode(viewState);
        eventValidation =System.Web.HttpUtility.UrlEncode(eventValidation);
        submitButton =System.Web.HttpUtility.UrlEncode(submitButton);

8.        responseData= webClient.UploadData(uriString, "POST", postData);

9.       DocumentCompleted Event;

10.     tbPasswd.SetAttribute("value", "12345678");

11.     btnSubmit.InvokeMember("click");

12.     HtmlElement tbUserid = webBrowser.Document.13.     String request= reader.ReadToEnd();

14.      string postString= "userName=1&password=1" + "&loginButton=" + submitButton+ "&__VIEWSTATE=" + viewState +"&__EVENTVALIDATION=" + eventValidation;

15.            catch (WebExceptionwe)
       {
           
string msg= we.Message;
       }

16.      查看网页POST的数据还可以通过一些工具来查看,比如: 网页数据分析工具HttpWatch,网络嗅探器等。

17.    备注:以下为Post方式提交数据编码几种方式:

text/plain

以纯文本的形式传送

application/x-www-form-urlencoded

默认的编码形式,即URL编码形式

multipart/form-data

MIME编码,上传文件的表单必须选择该

18.     HttpWebRequest

19.     HtmlDocumenthtmlDoc = webBrowser.Document; 
HtmlElement btnElement = htmlDoc.All["btnClose"]; 
if (btnElement != null) 

     btnElement.click += newHtmlElementEventHandler(HtmlBtnClose_Click); 
}

20.     formElement.AttachEventHandler("onsubmit",new EventHandler(HtmlForm_Submit));

21.     HttpAnalyzer V2.

22.     this.Text = this.webBrowser1.Document.ActiveElement.GetAttribute("href");

23.     PrivateSub WebBrowser_NewWindow(ByVal sender As Object, ByVal e AsSystem.ComponentModel.CancelEventArgs) Handles WebBrowser.NewWindow 
        Dim NewUrl As String 
        NewUrl = CType(sender, Windows.Forms.WebBrowser).Document.ActiveElement.GetAttribute("href") 
        Me.WebBrowser.Url = New Uri(NewUrl) 
    End Sub

24.      string M_StrURL=((WebBrowser)sender).Document.ActiveElement.GetAttribute("href");

  this.webBrowser2.Url = new Uri(M_StrURL);

25. (1) Create a web request

HttpWebRequest req =(HttpWebRequest)WebRequest.Create("http://www.google.com");

(2) then create a web response for therequest and then create a reader

  HttpWebResponse response =(HttpWebResponse)req.GetResponse();
            StreamReaderreader = new StreamReader(response.GetResponseStream());
            stringstrSite = reader.ReadToEnd();

25.      Reflector查看了一下WebClient的代码,发现WebClient每次发请求(DownloadString)时都会调用自己的一个叫GetWebRequest的方法。

26.     访问第一页时,服务器会返回一个Cookies值,打开第二页时要向服务器提交访问
第一页时返回的Cookies,才能打开页面。可以这样解决:

打开第一页时:

byte[] buff=webclient.DownloadData(url);
string cookie=webclient.ResponseHeaders.Get("Set-Cookie");

向第二页发送请求时:

webclient.Headers.Add("Cookie",cookie);

27.     post方法访问站点,要注意的是:post一定要是大写,不然报403错误.

28.     对于aspx网页一定要注意viewstate,如果不post viewstate,后台程序是不会处理的.

29.    之所以能够保持 Session  Cookie 是因为使用了 Cookie 容器(CookieContainer),见红色的代码部分。

30.    System.Text.Encoding.Default;(=UTF8) //>>Default Encoding

31.Console.WriteLine("/nHeader Name:{0}, Value :{1}",myHttpWebResponse.Headers.Keys[i],myHttpWebResponse.Headers[i]);

32.foreach(Cookie cookie in response.Cookies) 
cookieContainer.Add(cookie);

33.cookieheader= req.CookieContainer.GetCookieHeader(new Uri(url));

34.HWRes.GetResponseHeader("Set-Cookie");

35.request.AllowAutoRedirect= true;

36.req.CookieContainer.GetCookieHeader(new Uri("http://www.5460.net/txl/login/login.pl"));   

 

*How to Post Data ByHttpWebRequest(>>How to post data by HttpWebRequest>>Send Data ByHttpWebRequest>>how to use httpwebrequest>>how to usehttpwebresponse):

[ASP.net] (>>HttpWebRequest andASP.Net>>HttpWebResponse And ASP.net>>ASP.net andCookie>>ASP.net and Session)

----Example 1----

http://jims57.blog.163.com/blog/static/951361720098161568643/edit/?mode=prev

----Link----

http://msdn.microsoft.com/en-us/library/debx8sh9.aspx

 

 

>> ASP.Net(>>ASPX):

*WebBrower to get the cookie in ASP.netwebsite(>>ASP.Net Cookie>>ASPX Cookie):

Webbrowser.document.cookie  can not get   ASP.NET_SessionId   value

 

>>WebBrowser:
*WebBrowser url(>>WebBrowser URL>>WebBrowser URI):
[C#]
----2 ways----
this.webBrowser1.Url = new Uri("http://www.baidu.com");
this.webBrowser1.Navigate("http://203.143.139.35/codesk3/Authenticate.aspx");

*Control webPages(>>Control webPage>>WebBrowser controlwebpages>>Control websites>>Control webpages by webbrowser)
[C#]
        private void button1_Click(object sender,EventArgs e)
        {
           this.webBrowser1.Url = new Uri("http://www.baidu.com");//Orthis.webBrowser1.Navigate("http://203.143.139.35/codesk3/Authenticate.aspx");


        }

        private voidwebBrowser1_DocumentCompleted(object sender,WebBrowserDocumentCompletedEventArgs e)
        {
               MessageBox.Show(string.Format("Current URL is{0}",this.webBrowser1.Url.ToString()));
               HtmlElement HEUserName = this.webBrowser1.Document.All["txtUserId"];
               HtmlElement HEPWD =this.webBrowser1.Document.GetElementById("txtPassword");
               HtmlElement HESubmit =this.webBrowser1.Document.GetElementById("imgLoginBtn");

               HEUserName.SetAttribute("value", "chendej@cn.ibm.com");
               HEPWD.SetAttribute("value", "chendej@cn.ibm.com");
               HESubmit.InvokeMember("click");
}

 

>>DataTable:

*Create DataTable dynamically:(>>CreateDataTable dynamically)

----Example----

    Example 1. (>>add data to datatable>>Add datato datatable>>Define DataTable columns)

 

*DataTable rows:(>>DataTableRows>>DataTable Row collection)

---->>Get DataTable row collection----

[ASP.Net]

    DataRowCollectionDRC=DataTable.Rows;

 

*DataTable Columns:(>>DataTableColumns>>DataTable Column collection)

---->>Get DataTable columncollection----

[ASP.Net]

    DataColumnCollectionDCC=DataTable.Columns;

 

*DataTable load DataReader(>>DataTableload DataReader)

DataTable.Load(SqlDataReader);


*ImportRow(>>ImportRow>>ImportRow>>DataTable.Clone()>>Clone datatable>>Copy DataTable):
DataTable=AnotherDataTable.Clone();//Before it can use the following importrowcommand, it has to use the command to clone the structure of datatable.
DataTable.ImportRow(AnotherDataTable.Rows[Index]);(>>Import datatablerows)

 

>>DataList:

*DataList Select Item Event:(>>DataListSelect Item Event>>DataList Event>>DataList Button event)

http://jims57.blog.163.com/blog/static/9513617201022854838318/ //>>DataListArgument>>DataList Item Event

>>FindControl:(>>Find Controls)

*FormView Find Control:(>>FormViewFindControl>>Find FormView Control)

Label MyLabel=FormView.FindControl("TitleTabel")as Label

 

>>DataView:

*Get DataView:(>>Get DataView)

[ASP.Net]

    1.DataViewDV=DataSet.Tables[0].DefaultView;//>>Get Default DataView

    2.DataView DV=newDataView(DataSet.Tables[0],"BookAuthoer='Jim'","BookPrice",DataViewRowState.CurrentRows);

    //BookPrice means sort byit,"CurrentRows" are not included the rows which are notchanged,modified and new rows.

    (>>DataView Rowstate>>DataView State>>New dataview>>New DataView)    

 

*DataView Filter Row(>>FilterRow>>DataView Filter Row>>RowFilter>>RowFilter>>DV filter):

1.DataView.RowFilter = "ParentItemID=" + ItemID.ToString();//>>Filter data by dataview

 2.DV.RowFilter="BookAuthor='Jim'";

3.DV.RowFilter="(ID<20) and (usernamelike '%user%')"; 

 

*Convert DataTable to DataView(>>ConvertDataTable to DataView>>DataTable and DataView>>DataView andDataTable):

DataView thisView = new DataView(thisTable);//创建DataView对象(>>Get DataView)

----Convert DataView toDataTable----(>>Convert DataView to DataTable>>convert dataview totable)

M_DT=M_DV.ToTable();

 


>>TimeSpan(>>Time Span):
*How to use TimeSpan(>>How to use TimeSpan>>How to use Time Span):
[C#]
TimeSpan M_Tms = new TimeSpan(0, 3, 0, 0);
DateTime.Now-M_Dtm>T_Tms;//M_Dtm is another value of Datetime.

>>New Line(>>New Line>>New Row):
[C#]
*New line in TextBox:
this.TextBox1.Text="I will new a line/r/n";///r/n is the line newmethod.(>>/n>>/r)

>>Rownumber(>>Row_Number>>Row_Number()>>SQL rowcount>>SQL row number>>Get Row number in Procedure>>GetProcedure ID>>Get Procedure Row number):
[For SQL 2005]
select ROW_NUMBER() over (Order By tb_CaseInfo.Logged desc) as ID fromForm1//Row_Number() can only be used in SQL after 2005 version.

>>GetType():
*Check the type of the Control(>>Check control type>>Control Type):
----Way 1----
if(Control.ControlCollection.GetType().Name=="TextBox")
{
Do something;
}
----Way 2----
if(Control.ControlCollection.GetType().ToString()=="System.Windows.Forms.TextBox")
{
Do something;
}

>>Control.ControlCollection(>>System.Windows.Forms):
*Reference Control.ControlCollection:
Before the control.ControlCollection can be used, it has to reference"System.Windows.Forms"

>>Procedure:
*Insert into format(>>Insert into format):

Insert into Form1(Name,Sex)values(@Name,@Sex)

*How to use Insert into select:(>>Insert Into select from)
INSERT INTO Form1([Name],[Loc]) select Name,Loc fromForm2            
GO
**************************************************************************************************************************************
[Be Noted]
a.Field count must be the same.
b.If Form1 has any trigger, we have to stop the trigger on the form before wecan execute the above command in procedure in SQL server.
c.The field length in Form1 must be no less than the length you input formForm2.
***************************************************************************************************************************************

*Parameter in SQL server procedure(>>SqlParameter>>Parameter inProcedure>>Procedure Parameter>>SQL Procedure Parameter):
a.The Sequence of Parameter must not be the ordinal.
b.The count of Parameters has be the same.
*************************For Example***********************************
[Procedure]
ALTER PROCEDURE [dbo].[Proc_Test]
(
@Name Varchar(10)=null,//@Name is first one.
@Loc VarChar(10)=null
)
AS
BEGIN
insert into tb_Test(Name,Loc) values(@Name,@Loc)
END

[C#] (>>How to set SqlParameter In C#)

        ----Way1----
           SqlParameter[] M_P=new SqlParameter[2];
            M_P[0] = newSqlParameter("@Loc", SqlDbType.VarChar, 20);//Loc is first one
            M_P[1] = newSqlParameter("@Name", SqlDbType.VarChar, 20);//>>Setsqlparameter type

            M_P[0].Value= "Loc333";
            M_P[1].Value= "Name Jimd";
           DB.DBManager.ExeNonByProc("Proc_Test", M_P);

        ----Way2----

          http://jims57.blog.163.com/blog/static/9513617201022592341885/

***********************************************************************

*Case-Sensitive in SQL(>>Procedure Upper>>ProcedureCase-Sensitive>>Procedure Upper>>Procedure Case Sensitive):
[SQL Server]
Select distinct * from tb_AllCNAsset where upper(CNH)=@CNH //upper can make CNHto be the upper case.

*Like search in Procedure(>>Like Search in Procedure>>ProcedureLike>>SQL like):
Select distinct * from tb_AllCNAsset where upper(CNH) like '%'+@CNH+'%'

>>Window:

*Window Handling>>(>>WindowHandling>>Handle Window)

[JS](>>JS handle window)

    ---->>New JSwindow---- 

    varoWin=window.open("http://www.163.com","_blank","height=300,width=400,top=30,left=40,resizable=yes");//_blank={_self,_parent,_top,_blank}(>>openwindow>>new window>>open JS window>>new js window)

    ----->>Close JSwindow----

   oWin.close();//>>Close JS window>>JS close window

    ---->>Open JSwindow----(>>Open JS previous windows)

    oWin.opener;//Use .openerproperties to open the previous window

    ---->>Other JSwindow----

    oWin.history.go(-1);//Goback to the previous,oWin.history.back(); 

   oWin.history.go(1);//Forward next window,oWin.history.forwared();   

 

*User Windows:(>>User windows)

---->>Prompt window----

[JS](>>Js prompt windows)

    varsInput=prompt("Input the name","Jim");//Jim is the defaultvalue.

---->>Tip Windows----

[JS](>>JS tip windows>>JS alertwindows)

    alert("I am thealert.");

---->>Confirm window----

[JS](>>JS confirm windows>>JSconfirmation windows)

    if(confirm("delete ornot?"))

    {

       alert("Deleted.")

    }

    else    

    {

       alert("No not del.");

    }


>>Text:
*Different between text and Ntext in SQL server(>>NText>>Differentbetween Text and Ntext):
[Text]->For pure English and Number
[NText]->For including Chinese Characters.[Unicode]

>>DateTime(>>Date And Time>> Date Time):

*Get DateTime:(>>Get DateTime)

[JS](>>Get JS dateTime>>GetJavascript Datetime)

    var MyDate=new Date();//>>NewJS datetime

    variMonth=MyDate.getMonth+1;//the month number begin from 0, so you must plus1.(>>Get JS current month)

    

*Get the current DateTime:(>>Getcurrent date time>>Get current datetime>>GetDate()>>Getcurrent DT)

[SQL server]

    GetDate();//In SQL server,use this way to get the current datetime;//>>Get SQL currentDatetime>>Get SQL current Date And Time

[C#]

    DateTime.Now;

 

*DateTime type:(>>DateTimetype>>Date Time Type>>Variable Type>>Variables Type)

SmallDateTime:Accurate to minutes, 4memory.//>>SmallDateTime.

DateTime:More accurate, 8 memory.


*Format Datetime(>>DateTime format>>Format DateTime):

[C#] (>>C# datetime format)
string StrMyDateTime=DateTime.Now.ToString("yyyy-MM-ddHH:mm:ss");//Month must be "MM",if want to represent as 24 hoursformat, must be used "HH",otherwise use "hh".

[Oracle] (>>Set Oracle datetimeformat>>Oracle datetime format>>Oracle date format)

    ##----SQL----##

    selectto_char(sysdate,'mm/dd/yy') from dual //(>>Oracle to_char>>Changeoracle date format)

    

>>DataReader(>>SqlDataReader>>DR):

*DR Summary:(>>DRSummary>>DataReader Summary>>SqlDataReader Summary)

1.When return DR in an object, and the DR hasbeen used the method to get the first row, DR.Read(), so in another class, youdo not need to DR.Read().

    That is to say, theDR.Read() in a class will effect the another class access the DR.

 

*SqlDataReader HasRow:(>>SqlDataReaderHasRows>>HasRows>>SqlDataReader.HasRows)

if(SqlDataReader.HasRows)

{

    Do Something;
}


*Get name of column of DataReader(>>Get DataReader Columnname>>SqlDataReader Column name>>Get SqlDataReader FieldNames>>SQLDataReader Field name>>DataReader Field Name>>GetDR field name):
[C#]
SqlDataReader.GetName(0);Get the name of column 1

*Check if the value is DBnull(>>SqlDataReader DBNull>>SqlDataReaderNull>>DBNull>>DataReader Null>>SqlDataReader Null>>DRnull>>Null):
if(SqlDataReader[0] is DBnull)
{
MessageBox.Show("It is the DBNull.");
}
else
{
MessageBox.Show("It is not the DBNull.");
}

*Get Count of DataReader Filed(>>DataReader Field count>>Get Columnnumber>>Get DataReader Field count>>SqlDataReader FieldCount>>Get SqlDataReader Field Count):
SqlDataReader.FieldCount;//Get count of SqlDataReader.

*Get value method of SqlDataReader(>>Get DR value>>Get DataReader value>>GetSqlDataReader Value>>DataReader Get Value>>SqlDataReader GetValue):
SqlDataReader.GetBoolean(0);//if the 0 column is bit in SQL database, it canget the "true" or "false" by the way directly.
SqlDataReader.GetInt32(0);//Get the value of column in Database,which is"int" type.

SqlDataReader.GetString(Index);

SqlDataReader.GetValue(M_IntI).ToString();//Thebasic method

SqlDataReader["FieldName"].ToString();//>>GetDR Value by Field name

SqlDataReader.GetValue(SqlDataReader.GetOrdinal("FieldName"));//>>GetDR Field index by Field name


(>>?:):
*How to use IIF:
[C#]
int I=IsAdmin=="Admin"?1:0;//If the "IsAdmin" equals"admin",return 1,if not, return 0

>>TextBox:
*Set focus for the TextBox(>>Set Focus for TextBox>>TextBoxFocus>>TextBox.Focus()>>TextBox.Select()>>TextBox Get focus):
[C#]
this.TextBox1.Select();//Have to use "Select()" before the"Focus()" takes effect.
this.TextBox1.Focus();//Get the focus

>>ArrayList(>>Array List):

*Find ArrayList Items:(>>Find ArrayListItems>>Search for ArrayList items)

[ASP.Net]

    intM_IntFoundItemIndex=ArrayList.BinarySearch(7);//Find 7 index in ArrayList,index begin as 0.

*Sort ArrayList Item:(>>Sort ArrayListItems>>Sort arraylist data)

[ASP.Net]

    1.ArrayList.Sort();//If{5,4,3,2,1} become {1,2,3,4,5}

    2.public virtual voidSort(IComparer M_Comparer); See example.

 

*Remove ArrayList Item(>>Removearraylist items>>Delete ArrayList Items>>Delete Items)

[ASP.Net]

    1.ArrayList.Remove("ItemName");

   2.ArrayList.RemoveAt(ItemIndexYouWantToRemove);

   3.ArrayList.Remove(BeginIndexOfRemoving,RemoveCount);

 

*Add Item to ArrayList:(>>Add item toArrayList>>Add items to ArrayList>>Add ArrayList Items)

----Add Item----

[ASP.Net]

   1.ArrayList.Add("Value");

   2.ArrayList.AddRange(AnotherArrayList);//Add "Hello 1" and"Hello 2" to it, if AnotherArrayList have the two values.

----Insert Items----(Mean the added item willbe added any where you want)

[ASP.Net] (>>Insert item to ArrayList)

   1.ArrayList.Insert(Index,ArrayList2);//Index begin as 0.If Index=1, itmans the added item will be inserted into the 2 place. See example.

 

*New ArrayList:(>>New arraylist)

[ASP.Net]

    ArrayList M_Ary=newArrayList();//Do not specify the count of arraylist, Default=16.If items isover the capacity of arraylist, it will add capacity by 1 times.

    ArrayList M_Ary=newArrayList(50);//Specify the capacity of the arraylist.

[JS]

    var iNumbers=new Array();

 

*ArrayList Count(>>ArrayListCount>>ArrayList.Count>>Get ArrayList Count):

ArrayList.Count to get the actual countArrayList has


*Clear records in Arraylist(>>Clear ArrayList>>ArrayList.Clear())
ArrayList.Clear();//Clear all the records in the ArrayList

*Reference ArrayList(>>ArrayList reference>>ReferenceArrayList>>ArrayList Namespace):
using System.Collections;//Before we are capable of using the"ArrayList",we have to reference it.

>>MessageBox(>>Message Box>>Info template>>Messagetemplate):

*MessageBox Tip Template(>>Messageboxtemplate):

----Template 1----(AboutWarning>>Messagebox Warning template)

MessageBox.Show("Error:An unexpectederror happens,maybe the coDesk is not reachable, please tryagain.","Tip",MessageBoxButtons.OK,MessageBoxIcon.Warning);

----Template 2----(>>MessageBox TipTemplate>>MessageBox information Template>><essagebox infotemplate)

MessageBox.Show("Error:An unexpectederror happens,maybe the coDesk is not reachable, please tryagain.","Tip",MessageBoxButtons.OK,MessageBoxIcon.Question); 

----Template 3----(>>Messagebox errortemplate)

MessageBox.Show("Error:An unexpectederror happens,maybe the coDesk is not reachable, please tryagain.","Tip",MessageBoxButtons.OK,MessageBoxIcon.Error); 

 

*Confirmation ofMessageBox(>>DialogResult.Yes>>MessageBoxConfirmation>>Confirm message>>Confirm MessageBox):

[WinForm]

               if (DialogResult.Yes == MessageBox.Show("You do not input any note for thecurrent action, do you want it empty?", "Tip",MessageBoxButtons.YesNo, MessageBoxIcon.Question))
               {
                   this.Hide();
               } 

 [WebForm](>>WebForm ConfrimMessage>>Web form confirm message>>JS confirmmessage>>Javascript Confirm Message)

    ----Example----(>>WebformConfirm Message)

        Example 1.(>>Attribute) 

 

*MessageBox NameSpace(>>MessageBoxNameSpace>>MessageBox Name Space):

using System.Windows.Forms;


*Newline in Messagebox(>>Change Line>>Change MessageBoxLine>>MessageBox new line):
MessageBox.Show("Do you want to change a new line?/nI am a newline.");//The /n is the new line in MessageBox

>>Number:

*Check number:(>>Check number>>Checkif number)

[JS] (>>JS check number)

    if(isNaN(iNumber))//UseisNaN to check if the number, iNumber is a variable.

    {

    }

[]

    *Numberformat(>>Number Format>>Number Validation):
[.Net] (>>.Net check number)
    Regex.IsMatch(P_str_num, "^[0-9]*$");
   **********************************************************************************************
    Before using "Regex",we have to reference thenamespace "using System.Text.RegularExpression;" (>>RegexNamespace)
    **********************************************************************************************


>>Path:

*Get absolute path:(>>AbsolutePath>>Get path)

[ASP.Net]

   Server.MapPath("./AFolder/")+fileName;//>>Relative path

   Request.Url.AbsolutePath;(>>Get Absolute path)

    Request.Url.ToString();//Getthe full path of current page

   Request.ApplicationPath;(>>Get Application Path>>ApplicationPath)//Get the application path,you can use it by:       

   Response.Redirect(Request.ApplicationPath+"/Page.Aspx");//>>Redirect>>Response.Redirect

   @"http://"+HttpContext.Current.Request.Url.Host+HttpContext.Current.Request.ApplicationPath;//>>Getfull application path>>Get full website path


*Get the startup path(>>Get Startup Path>>Startup path>>StartUp Path):
[C#]
System.Environment.CurrentDirectory;//Get the current directory of softwarestartup.

 
*Path represent:(>>current path)
[C#]
“../”==The directory above the current directory
"./"==Current directory

>>IO:
*Reference for StreamReader and StreamWriter(>>StreamReader Reference>>StreamWriterReference>>System.IO):
Before we can use the StreamReader and StreamWriter, we have to reference"using System.IO"

>>XML:
*Creat XML file(>>Creat XML File):
[C#]
----Way 1----
using System.Xml//reference System.Xml name space
new XmlDoucment XD=new XmlDocument();//Set up a new XML document
XD.LoadXml("<Root><Name>Jim</Name></Root>");//UseLoadXml method to fill the object XD
XD.Save("C://jim.xml");//Save the XML content into XML file

*Read XML File(>>Read XML File>>Display XML content):
[C#]
----Way 1----
using System.Xml
XmlDocument XD=new XmlDocument();
XD.Load("C://jim.xml");//Load into the specific XML file into theobject of XML
XmlNodeReader reader=null;//Use the XmlNodeReader object to read XML data
reader=new XmlNodeReader(XD);//Copy the content in XD into reader
string s="";
while(read.Read())
{
switch(reader.NodeType)//Judge the type of XML node
{
Case XmlNodeType.Element:
s=reader.Name;
break;
Case XMLNodeType.Text:
if(s.Equals("Name"))
string strNeedValue=reader.Value;
else

}
}
----Way 2----
using System.Xml;
XmlDataDocument DD = new XmlDataDocument();//XmlDataDocument is only the dataformat for XML
StreamReader SR = new StreamReader(@"C:/jim.xml");//Use jim.xml makethe streamReader object
DD.DataSet.ReadXml(SR);
this.Text = DD.DataSet.Tables[0].Rows[1][0].ToString();

----Way 3----

stringGotContentFromXML=XMLFile.GetElementsByTagName("ATagName").Item(0).InnerXml;//Get XML element by tag name

*Change XML file content(>>Change XML file>>Modify XML file):
[C#]
----Way 1----
XmlDocument XD2 = new XmlDocument();
XD2.Load(@"C:/jim.xml");
XmlNode n = XD2.SelectSingleNode("//SN");//Has to user "//"
n.FirstChild.Value = "Jims88";//FirstChild means the SN node,that isthe current node
XD2.Save(@"C:/jim.xml");
*****************************
----jim.xml content------
<E>
  <No1>
    <Name>Jims88</Name>
    <SN>Jims88</SN>
  </No1>
</E>
*****************************

----Way 2----
XmlDocument doc=new XmlDocument();
doc.Load(@"C:/jim.xml");
foreach (XmlNode node in doc.SelectNodes("//price"))//doc.SelectNodesis a collection of "price" nodes
{
    node.InnerText = (XmlConvert.ToDouble(node.InnerText) *1.2).ToString();//Set the value for each node named "price" after therelated calculation
}
doc.Save(@"C:/jim.xml");//Have to save the XML file to upate thechanged data

----Way 3----
XmlDocument XD = new XmlDocument();
XD.Load(@"C:/jim.xml");
XmlNodeList NL = XD.GetElementsByTagName("Name");//XmlNodeList is thecollection of XML nodes.
foreach (XmlNode n in NL)
{
     n.InnerText = "kkkk";
}
XD.Save(@"C:/jim.xml");

----Way 4----(>>Change XML using DataSet)
XmlDataDocument XDD = new XmlDataDocument();
StreamReader SR=new StreamReader(@"C:/jim.xml");
XDD.DataSet.ReadXml(SR);
DataSetDS=XDD.DataSet;            
DataTable DT = DS.Tables[0];
DT.Rows[0][0] = "ChangedValue";//Change value
DS.AcceptChanges();//The method is not the necessary to do in changing thevalue of a XML file.
SR.Close();//Have to close the StreamReader before using StreamWriter
StreamWriter SW = new StreamWriter(@"C:/jim.xml");
XDD.DataSet.WriteXml(SW);

*XML node case sensitive(>>XML Case Sensitive):
XmlNodeList NL=XD.SelectNodes("//Name");//The "N" in Namemust be upper case

*XML Node Array(>>XML Array>>XML Node Array):
XmlNodeList NL=XmlDoc.SelectNodes("//Name");

>>Control Website(>>Third party Provider>>ControlWebsite>>Component Websites):
*Control Website Link:
http://www.devexpress.com
[>>Ajax>>Silverlight]
http://www.componentart.com/default.aspx

>>RegularExpression(>>Regular Expression>>Regex):

*Regex NameSpace(>>RegexNameSpace>>Regex Name Space):

using System.Text.RegularExpressions;


*Meta-Character for the RegularExpression(>>Meta-Character>>RegexSymbol):
http://www.exforsys.com/tutorials/csharp/regular-expressions-and-csharp-.net.html

*URL format(>>URL Form>>Web addressFormat>>Web Address>>URL Validation>>Validate URL):
http://([/w-]+/.)+[/w-]+(/[/w- ./?%&=]*)?

*All English letter format(>>English Letter format):
Regex.IsMatch(P_Str,"^[a-zA-Z]*$");

*IP format(>>IP Format>>Validate IP address>>IP addressvalidation):
----Way 1----
string t11 = "55.54.53.52";
string p11 = "^" +
  @"([01]?/d/d|2[0-4]/d|25[0-5])/." +
  @"([01]?/d/d|2[0-4]/d|25[0-5])/." +
  @"([01]?/d/d|2[0-4]/d|25[0-5])/." +
  @"([01]?/d/d|2[0-4]/d|25[0-5])" +
  "$";
Match m11 = Regex.Match(t11, p11);

----Way 2----
stringStrPattern=@"^(0|[1-9][0-9]?|1[0-9]{2}|2[0-4][0-9]|25[0-5])/.(0|[1-9][0-9]?|1[0-9]{2}|2[0-4][0-9]|25[0-5])/.(0|[1-9][0-9]?|1[0-9]{2}|2[0-4][0-9]|25[0-5])/.(0|[1-9][0-9]?|1[0-9]{2}|2[0-4][0-9]|25[0-5])$";
Regex.IsMatch(this.TextBox1.Text,StrPattern);

>>Report(>>ReportDocument):
*How to use the report Doucment(>>Report Document):
ReportDocument r=new ReportDocument();
string strReportPath;
r.Load(strReportPath);
r.DataDefinition.RecordSelectionFormula=strSQL;

>>Application:

*Application data:(>>Applicationdata>>Application share data)

---->>Set application data----

[ASP.Net]

   Application.Add("key1","value1");

---->>Get application data----

[ASP.Net]

   Application.Contents["key1"];


>>Application.StartupPath(>>Startup>>//):
[C#]
Application.StartupPath.ToString()+"//Jim.txt"
//System will just show "/"

>>IndexOf:
*How to use IndexOf :

[C#]
int i;
i="12345".IndexOf("3");
//i will be 2.

//Index begin from 0

//When found no, return -1

----Exmaple 1----

http://jims57.blog.163.com/blog/static/9513617200992972216301/edit/?mode=prev

>>OpenFileDialog:
*How to use the OpenFileDialog:
OpenFileDialog OFD = new OpenFileDialog();
OFD.Filter = "Word Files (*.docx)|*.docx|All Files(*.*)|*.*";
if(OFD.ShowDialog()==DialogResult.OK)
{
MessageBox.Show("Press OK button.");
this.label1.Text = "Your selected file name is " +OFD.FileName.ToString();
}

>>Label:
*Get the label text(>>Label Text):


>>Search:
*.Net Lucene data(>>Lucene>>.Net):
Link:http://incubator.apache.org/lucene.net/docs/2.1/

>>DoEvents:
*DoEvents(>>VBA DoEvents):
This action can go on doing the action while opening the IE:
Set IE = Nothing
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "http://203.143.139.35/codesk3/Incident/AgentHome.aspx"
Do Until IE.readyState = 4
DoEvents
Loop

>>Microsoft Internet Control:
*Reference "Microsoft InternetControl"(>>Shdocvw.dll>>Reference>>Controls)
Add "Shdocvw.dll" in Reference of Excel VBA

 

>>Property:

*Set Property:(>>Set Property)

[C#] (>>c# property)

    ----Example----

        Example 1.

    ----Info----

        Info 1.(>>Attribute>>what isattribute>>What is property)

 

*Difference between property andattribute:(>>Difference between property and attribute>>Propertyand Attribute)

   Info 2.

   Info 3.


>>Form:
*The difference among Close,Hide and Dispose(>>Form.Close()>>Form.Hide()>>Form.Dispose()):
[Form.Close()]
Close the form, but it doesn't release the related resource.
[Form.Hide()]
Hide the form, after that, the form can not show by "Form.Show()",the related resource is not released.
[Form.Dispose()]
The resource of the form will be released.

*The difference between ShowDialog andShow(>>ShowDialog>>Show>>Different between ShowDialog andshow>>Different between Show and ShowDialog):
[ShowDialog]
After "ShowDialog", for instance, Form.ShowDialog();, the followingsentence will not be executed.
[Show]
After "Show",the following sentence will go on executing.
************************************************************************
Link: http://hi.baidu.com/hooyan/blog/item/66d567a708145c92d0435844.html
************************************************************************

*Close form(>>Form close handler>>Close FormEventArgs>>Form Closing>>Form.Closing>>Form closeevent>>Form Event):
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmServerSetting_FormClosing);//Haveto add the handler when form is loading
private void FrmServerSetting_FormClosing(object sender, FormClosingEventArgse)//Form closing event
{
   if (MessageBox.Show("Are you sure to exitthe application?", "CoDesk Assistant Tip",MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)//Want toquit the application
    {
     }
     else
    {
     }
}

*Show User form(>>Show Form>>Show User Form>>Hide form):
[C#]
----Way 1----
this.Show();//Show the current form
this.Hide();//Hide the current form

----Way 2----
Form1 frm=new Form1();
frm.Show();

----Way 3----
Form1 frm=new Form1();
Frm.ShowDialog();


>>Length:
*The Length of array(>>Array Length>>array size):

---->>Get Array size----(>>Get arraylength)
[C#|ASP.net](>>GetLength(0)>>Get length)
int[] Ary=new int{1,2,3}
int a=Ary.Length //a=3

or

int b=Ary.GetLength(0);//b=3, Getlength(0)means get the array length.

[JS]

    array.length;//L must belower case.

[jQuery]
    $("div").size();  //
$("div").get(); ,use it to get the array object.(>>Get array object)


>>Count:
*The Count method in IE(>>Length):
Xbody.Childnoes.length

>>IE(>>Internet Explorer>>Explorer):
*Get the opened IE object(>>IE Object):
HH:
Dim SWs As ShellWindows
Set SWs = New ShellWindows
Dim IEW As InternetExplorer
For Each IEW In SWs
        Do Until IEW.readyState = 4
        DoEvents
        Loop
    If TypeOf IEW.document Is HTMLDocument AndTrim(IEW.document.Title) = "coDesk - Search User" Then
        IEW.document.frmUserSearch.txtSearchUser.Value= "12345"
        GoTo GotOne:
    End If
Next
GoTo HH:
GotOne:
MsgBox "Find one!"
Set IEW = Nothing
Set WSs = Nothing

*How to use IE in VBA(>>Connect IE>>Create IE>>UseIE>>Reference IE>>Create IE Object):
Set IE=CreateObject("InternetExplorer.Application")
IE.Visible=true
IE.Navigate "www.baidu.com"
Set IE=Nothing

*Test the Loading status of IE(>>IE status):
Do until IE.ReadyState=4 '4 means the IE has loaded totally
   Do Sth.
Loop

>>IE Document Object(>>Document):
*Document event:(>>Document events)

---->>Document Onclick event----

>>Sleep(>>Wait):
*How to use the Sleep sub
Private Declare Sub Sleep Lib "Kernel32"(ByVal dwMilliseconds asLong)

Sub MySub()
Sleep(5000)'Or Sleep 5000
End Sub
***********************************
Type the sentence before the sub
The "S" in Sleep must be Uppercase.
***********************************


>>Dir(>>FileSearch):

*The replacement forthe Application.FileSearch:
Sub Open_All_Files() 
Dim oWbk As Workbook 
Dim sFil As String 
Dim sPath As String 
sPath = "C:/Documents and Settings/Roy Cox/My Documents/" 'locationof files 
ChDir sPath 
sFil = Dir("*.xlsx") 'change or add formats 
Do While sFil <> "" 'will start LOOP until all files in foldersPath have been looped through Set oWbk = Workbooks.Open(sPath &"/" & sFil) 'opens the file 
' do something 
oWbk.Close True 'close the workbook, saving changes 
sFil = Dir 
Loop ' End of LOOP
End Sub 

>>Excel file:
*Read the data without opening the Excel file(>>Read ExcelData>>Connect to Excel database):
Dim ObjApp As Excel.Application
Dim ObjWorkbook As Excel.Workbook
Dim ObjWorksheet As Excel.Worksheet
Dim IntWSNo As Integer
Set ObjApp = CreateObject("Excel.Application")
Set ObjWorkbook = ObjApp.Workbooks.Open(ThisWorkbook.Path &"/Test2.xlsx")
ObjApp.Visible = False
Set ObjWorksheet = ObjWorkbook.Worksheets(1)
IntWSNo = ObjWorkbook.Worksheets.Count
ObjWorkbook.Close
ObjApp.Quit
Set ObjWorksheet = Nothing
Set ObjWorkbook = Nothing
Set ObjApp = Nothing


>>Case(>>Case>>UpperCase>>LowerCase>>LowerCase>>C# UpperCase>>C# Upper Case>>C# Lower Case>>C#LowerCase>> To upper case):

*Change case:(>>Change case)

[C#] 

string.ToUpper();

string.ToLower();

[Javascript]

   "stringvalue".toUpperCase();//Become"STRINGVALUE", 

   "STR".toLowerCase();


>>Case:
*The Upercase in SQL(>>UCase>>Uppercase):
StrSQL = "Select * from [CN$] where UCase(Login_ID) like '%CNH" &FindValue & "%'"

>>Field:

*Combine Fields:(>>Combine fields)

[Oracle] (>>Combine oracle fields)

    ##----SQL----##

    SELECT员工职位 ||’ ’ ||员工姓名||’出身于’||出身日期as 员工出身信息 FROM 员工基本信息表; //Use || to combine the more than 1 fieldin Oracle

 

*Field Values:(>>Field Values)

---->>Get Field Values----

   ---->>ASPxGridView----(>>Get ASPxGridView Field Values)

        ----Example1----(>>Get ASPxGridView Selected Field Values)


*SQL search Text field in Excel(>>Text Field):
StrSQL = "Select * from [CN$] where Login_ID='cnh" &Cells(Target.Row, Target.Column).Value & "'"

>>Connection:

*Check the State ofConnection(>>Connection.State>>ConnectionState>>Connectionstate):

----How to use----

[C#]
            if(Con.State != ConnectionState.Closed)
            {
               Con.Open();
            }

---->>Connection Statetype----(>>Connection state type)

http://jims57.blog.163.com/blog/static/95136172010368561032/


*Execure SQL(>>SQL)
Con.execute SQL=RS.Open Sql,Con

*Excel connect to Access(>>Connect to Access>>Excel connect toAccess>>Connect Access>>Access):
[Connection to Access 2003]
Set Con=new ADODB.Connection
With Con
.ConnectionString="Provider=microsoft.jet.oledb.4.0;DataSource=C:/Access.mdb"
.Open
End With
Set RS=New ADODB.RecordSet
RS.Open Sql,Con,adOpenKeySet,adLockOptimistic'Can not use SetRS=Con.Execute(SQL),which will show -1

[Connect to Access 2007] [Method 1]
StrAccessPath = ThisWorkbook.Path &"/PhilipsDB.accdb"            
'Set the connection
Set Con = New ADODB.Connection
With Con
   .ConnectionString = "Provider=Microsoft.ACE.oledb.12.0;DataSource=" & StrAccessPath
   .Open
End With
Set RS=New ADODB.RecordSet
RS.Open Sql,Con,adOpenKeySet,adLockOptimistic'Can not use SetRS=Con.Execute(SQL),which will show -1

[Connect to Access 2007] [Method 2]
StrAccessPath = ThisWorkbook.Path &"/PhilipsDB.accdb"            
'Set the connection
Set Con = New ADODB.Connection
With Con
  .Provider = "Microsoft.ACE.oledb.12.0"
  .Open StrAccessPath
End With

>>DataSet

*Field:
Rs.Fields(i).Name'i>=0

>>Close:
*Close the RecordSet:
RS.Close'RS have to be before the Con
Con.Close

>>Excel:
*Read Excel 2007 and 2003 database:
[2007]
With Con
.Provider = "Microsoft.ACE.oledb.12.0"
.ConnectionString = "Extended Properties=Excel 12.0;" _
& "Data Source=" & StrSourcePath
.Open
End With
[2003]
With Con
.Provider = "Microsoft.jet.oledb.8.0"
.ConnectionString = "Extended Properties=Excel 8.0;" _
& "Data Source=" & StrSourcePath
.Open
End With

>>RecordSet:
*Next record:
RS.MoveNext

*Field:
Sheet.Cells(i,1)=RS("Field1")

>>EOF
*Do while(>>EOF)
Do While N2010ot rs.EOF     '
当数据指针未移到记录集末尾时,循环下列操作

    sht.Cells(i, 1) = rs("
字段1")    '把当前记录的字段1的值保存到sheet1工作表的第i行第1

    sht.Cells(i, 2) = rs("
字段2")    '把当前字段2的值保存到sheet1工作表的第i行第2

   rs.MoveNext                     '
把指针移向下一条记录

    i = i +1                       'i
1,准备把下一记录相关字段的值保存到工作表的下一行

Loop                                '
循环












 

原创粉丝点击