[{"data":1,"prerenderedAt":3152},["ShallowReactive",2],{"article-list-indexes-in-sql-server":3},{"article":4,"tags":201,"previous":216,"next":2167},{"id":5,"title":6,"author":7,"body":8,"createdAt":190,"description":191,"extension":192,"img":184,"meta":193,"navigation":194,"path":195,"seo":196,"stem":197,"tags":198,"updatedAt":190,"__hash__":200},"articles\u002Farticles\u002Flist-indexes-in-sql-server.md","List Indexes in SQL Server","[object Object]",{"type":9,"value":10,"toc":187},"minimark",[11,24,172,177,179,181],[12,13,14,15,19,20,23],"p",{},"The following SQL will list all indexes in within the database that you run the sql script.  I was looking for the option within Visual Studio - Data Dude add-on that displayed index differences between two databases.  I eventually discovered the line by line index comparison by exploding the Table-Indexes ",[16,17,18],"strong",{},"however"," I was unable to create the newly added script index in the 2nd database.  ",[16,21,22],{},"Is this possible? ","  In lieu of the shortcomings within Data-Dude I used the following script to manually compare and script the indexes in both databases.",[25,26,29,35,36,40,41,44,48,50,54,55,57,61,62,64,68,69,74,76,80,81,85,86,99,160],"pre",{"className":27},[28],"csharpcode",[30,31,34],"span",{"className":32},[33],"kwrd","DECLARE"," GetTables ",[30,37,39],{"className":38},[33],"CURSOR"," READ_ONLY",[42,43],"br",{},[30,45,47],{"className":46},[33],"FOR",[42,49],{},[30,51,53],{"className":52},[33],"  SELECT"," TABLE_NAME",[42,56],{},[30,58,60],{"className":59},[33],"  FROM"," INFORMATION_SCHEMA.TABLES",[42,63],{},[30,65,67],{"className":66},[33],"  WHERE"," TABLE_TYPE = ",[30,70,73],{"className":71},[72],"str","'BASE TABLE'",[42,75],{},[30,77,79],{"className":78},[33],"  AND"," OBJECTPROPERTY (OBJECT_ID(TABLE_NAME), ",[30,82,84],{"className":83},[72],"'IsMSShipped'",") = 0",[12,87,88,91,92,94,98],{},[30,89,34],{"className":90},[33]," @TableName sysname",[42,93],{},[30,95,97],{"className":96},[33],"OPEN"," GetTables",[12,100,101,105,106,105,110,35,114,118,119,121,125,126,128,132,134,138,139,141,105,145,105,148,35,151,118,154,156],{},[30,102,104],{"className":103},[33],"FETCH"," ",[30,107,109],{"className":108},[33],"NEXT",[30,111,113],{"className":112},[33],"FROM",[30,115,117],{"className":116},[33],"INTO"," @TableName",[42,120],{},[30,122,124],{"className":123},[33],"WHILE"," (@@fetch_status = 0)",[42,127],{},[30,129,131],{"className":130},[33],"BEGIN",[42,133],{},[30,135,137],{"className":136},[33],"  EXEC"," sp_helpindex @TableName",[42,140],{},[30,142,144],{"className":143},[33],"  FETCH",[30,146,109],{"className":147},[33],[30,149,113],{"className":150},[33],[30,152,117],{"className":153},[33],[42,155],{},[30,157,159],{"className":158},[33],"END",[12,161,162,98,166,168,98],{},[30,163,165],{"className":164},[33],"CLOSE",[42,167],{},[30,169,171],{"className":170},[33],"DEALLOCATE",[173,174,176],"style",{"type":175},"text\u002Fcss","\u003C![CDATA[csharpcode, .csharpcode pre  \n{  \n    font-size: small;  \n    color: black;  \n    font-family: consolas, \"Courier New\", courier, monospace;  \n    background-color: #ffffff;  \n    \u002F*white-space: pre;*\u002F  \n}  \n.csharpcode pre { margin: 0em; }  \n.csharpcode .rem { color: #008000; }  \n.csharpcode .kwrd { color: #0000ff; }  \n.csharpcode .str { color: #006080; }  \n.csharpcode .op { color: #0000c0; }  \n.csharpcode .preproc { color: #cc6633; }  \n.csharpcode .asp { background-color: #ffff00; }  \n.csharpcode .html { color: #800000; }  \n.csharpcode .attr { color: #ff0000; }  \n.csharpcode .alt   \n{  \n    background-color: #f4f4f4;  \n    width: 100%;  \n    margin: 0em;  \n}  \n.csharpcode .lnum { color: #606060; }  \n]]>",[173,178,176],{"type":175},[173,180,176],{"type":175},[182,183],"img",{"src":184,"alt":185,"style":186},"\u002Farticles\u002Fimages\u002Fsql2.gif","","display:none;",{"title":185,"searchDepth":188,"depth":188,"links":189},2,[],"2015-04-20T08:07:16.3900000-04:00",null,"md",{},true,"\u002Farticles\u002Flist-indexes-in-sql-server",{"title":6,"description":191},"articles\u002Flist-indexes-in-sql-server",[199],"sqlserver","PGhMpQ4KuNvCDC6fMPyQW3tunnAqa0GtOS8pvrjfWbo",[202],{"id":203,"title":204,"body":205,"description":209,"extension":192,"img":210,"meta":211,"name":199,"navigation":194,"path":212,"seo":213,"stem":214,"__hash__":215},"tags\u002Ftags\u002Fsqlserver.md","Sqlserver",{"type":9,"value":206,"toc":207},[],{"title":185,"searchDepth":188,"depth":188,"links":208},[],"SQL Server is a relational database management system, or RDBMS, developed and marketed by Microsoft.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fsqlserver",{"description":209},"tags\u002Fsqlserver","pSzcNnE-XyUgq8RlgK2xBpbJV7_7o5NLS2XlwBxFyAg",{"id":217,"title":218,"author":7,"body":219,"createdAt":2158,"description":2159,"extension":192,"img":2155,"meta":2160,"navigation":194,"path":2161,"seo":2162,"stem":2163,"tags":2164,"updatedAt":2158,"__hash__":2166},"articles\u002Farticles\u002Fmicrosoft-ajax-features-and-implementation-samples.md","Microsoft AJAX Features and Implementation Samples",{"type":9,"value":220,"toc":2156},[221,224,230,246,249,269,274,291,342,371,374,382,385,601,604,621,624,632,692,798,801,809,812,1220,1222,1225,1235,2152],[12,222,223],{},"There are many options within the Microsoft stack of products for AJAX type functionality.  The following article covers the primary mechanisms that utilize the Microsoft out of the box Ajax functionality.  Ajax must be one of the technologies used in all current web applications.  The primary benefit is the improved user experience by providing quick, responsive feedback.",[12,225,226,227,229],{},"Core features include Ajax Client Libraries and Ajax Server Controls.  These libraries and controls enable the developer to quickly implement solutions within any ASP.NET application. ",[42,228],{},"\nI have also included in this article the examples for utilizing the Microsoft AJAX libraries using:",[231,232,233,237,240,243],"ul",{},[234,235,236],"li",{},"update panel server control",[234,238,239],{},"access to web service from JavaScript",[234,241,242],{},"access to page methods (without web service)",[234,244,245],{},"HttpRequest\u002FPost from javascript.",[12,247,248],{},"AJAX Client Libraries",[231,250,251,254,257,260,263,266],{},[234,252,253],{},"Client-Script libraries that provide features for object-oriented development which enable high level of consistency and modularity in client scripting.",[234,255,256],{},"Browser compatibility",[234,258,259],{},"Extensions to JavaScript such as classes, namespaces, event handling, inheritance, data types and object serialization",[234,261,262],{},"Networking layer that handles communication with web based services",[234,264,265],{},"Sys Namespace",[234,267,268],{},"Javascript Shortcuts i.e. $get(‘elementId’), $addHandler, $removeHandler",[12,270,271],{},[16,272,273],{},"Asp.Net AJAX Server Controls",[231,275,276,279,282,285,288],{},[234,277,278],{},"ScriptManager",[234,280,281],{},"Manages Javascript",[234,283,284],{},"Enables partial page rendering w\u002FUpdatePanel",[234,286,287],{},"Creates client side proxies for Web Services",[234,289,290],{},"Provides registration methods for scripts",[292,293,294,295,294],"blockquote",{},"  \n",[25,296,298,299,303,304,308,309,313,314,317,318,322,323,327,328,332,333,336,337,341],{"className":297},[28],"\u003Casp:ScriptManager ID=",[30,300,302],{"className":301},[72],"\"mng1\""," runat=",[30,305,307],{"className":306},[72],"\"server\"","  \n                    EnablePartialRendering=",[30,310,312],{"className":311},[72],"\"true|false\"","  \n                    EnablePageMethods=",[30,315,312],{"className":316},[72],"  \n                    ScriptMode=",[30,319,321],{"className":320},[72],"\"Auto|Inherit|Debug|Release\"","  \n                    ScriptPath=",[30,324,326],{"className":325},[72],"\"...\"",">                          \n                    \u003CScripts>  \n                        \u003Casp:ScriptReference Name=",[30,329,331],{"className":330},[72],"\"script.js\""," Assembly=",[30,334,326],{"className":335},[72]," \u002F>  \n                    \u003C\u002FScripts>  \n                    \u003CServices>  \n                        \u003Casp:ServiceReference Path=",[30,338,340],{"className":339},[72],"\"~\u002FMyWebService.asmx\""," \u002F>                          \n                    \u003C\u002FServices>      \n       \u003C\u002Fasp:ScriptManager>",[231,343,344,347,350,353,356,359,362,365,368],{},[234,345,346],{},"ScriptManagerProxy",[234,348,349],{},"Used with Master Pages",[234,351,352],{},"If you include the ScriptManager control on the master page, it can act as the ScriptManager control for all content pages.  If you want to register scripts or services declaratively in a content page, you can add a ScriptManagerProxy control to the content page.",[234,354,355],{},"UpdatePanel",[234,357,358],{},"Improves user experience of application by updating a portion of the web page thereby improving interactivity",[234,360,361],{},"By default controls within the update panel can trigger the update.  ChildrenAsTriggers property is by default set to true.  In our example the link button is within the update panel and so can trigger the partial page update.  By default any postback control inside an update panel causes an async postback",[234,363,364],{},"Controls outside of the update panel can also trigger the panel contents to update.  For example look at btnGo, it resides outside the panel however it is defined within the panel as a trigger\u002Fcontrol that can force the async update to the panel contents.  Reference the \u003Casp:AsyncPostBackTrigger> element within the \u003CTrigger> element of the updatePanel",[234,366,367],{},"set EnableParitalPageRendering=”true”",[234,369,370],{},"Shown here is how a timer defined outside of the panel can trigger the update panel to refresh at a defined interval",[292,372,373],{},"  \n     \u003Casp:UpdatePanel id=”panel1” runat=”server” \n                              UpdateMode=”Always\u002FConditional” \n                              ChildrenAsTriggers=”true\u002Ffalse”> \n                       \u003CTriggers> \n                             \u003Casp:AsyncPostBackTrigger ControlID=”timer1”\u002F> \n                        \u003C\u002FTriggers> \n                        \u003CContentTemplate> \n                             \u003C!—page content here --> \n                       \u003C\u002FContentTemplate> \n        \u003C\u002Fasp:UpdatePanel> \n       \u003Casp:Timer id=”timer1” runat=”server” Interval=”3000” OnTick=”OnTimerTick”\u002F>  \n",[231,375,376,379],{},[234,377,378],{},"UpdateProgress",[234,380,381],{},"provides status information about partial-page updates in the UpdatePanel controls.  The content can be customized.  To prevent flashing when a partial-page update is very fast, you can specify a delay before the UpdatePanel control is displayed",[16,383,384],{},"\n Update Panel Example ",[292,386,387,388,456,457,294],{},"  \nCode behind which responds to the button click to update a label control with the current time.  \n",[389,390,294,392,294],"div",{"style":391},"line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 85.8%; font-family: consolas, 'Courier New', courier, monospace; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: gray 1px solid; padding: 4px;",[389,393,294,395,294,409,294,413,294,427,294,430,294,433,294,436,294,439,294,449,294,451,294,453,294],{"style":394},"line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: consolas, 'Courier New', courier, monospace; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,396,398,105,402,105,405,408],{"style":397},"line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[30,399,401],{"style":400},"color: #0000ff;","public",[30,403,404],{"style":400},"partial",[30,406,407],{"style":400},"class"," Panel : System.Web.UI.Page",[25,410,412],{"style":411},"line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: consolas, 'Courier New', courier, monospace; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;","{",[25,414,415,416,105,419,422,423,426],{"style":397},"    ",[30,417,418],{"style":400},"protected",[30,420,421],{"style":400},"void"," Page_Load(",[30,424,425],{"style":400},"object"," sender, EventArgs e)",[25,428,429],{"style":411},"    {",[25,431,432],{"style":397},"        lblName.Text = DateTime.Now.ToString();",[25,434,435],{"style":411},"    }",[25,437,438],{"style":397}," ",[25,440,415,441,105,443,445,446,448],{"style":411},[30,442,418],{"style":400},[30,444,421],{"style":400}," lnkButton_Click(",[30,447,425],{"style":400}," sender, EventArgs e) {",[25,450,432],{"style":397},[25,452,435],{"style":411},[25,454,455],{"style":397},"}","  \nPage HTML code with embedded update panel which responds to a control within the panel and a button defined as a trigger outside of the panel control.  \n",[389,458,294,460,294],{"style":459},"line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 86.23%; font-family: consolas, 'Courier New', courier, monospace; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: gray 1px solid; padding: 4px;",[389,461,294,462,294,465,294,475,294,488,294,496,294,499,294,516,294,535,294,538,294,541,294,548,294,551,294,554,294,565,294,568,294,571,294,574,294,577,294,580,294,582,294,595,294,598,294],{"style":394},[25,463,464],{"style":397},"\u003Cbody>",[25,466,467,468,303,472,474],{"style":411},"    \u003Cform id=",[30,469,471],{"style":470},"color: #006080;","\"form1\"",[30,473,307],{"style":470},">",[25,476,477,478,303,481,483,484,487],{"style":411},"        \u003Casp:ScriptManager ID=",[30,479,480],{"style":470},"\"ScriptManager1\"",[30,482,307],{"style":470}," EnablePartialRendering=",[30,485,486],{"style":470},"\"true\"",">\u003C\u002Fasp:ScriptManager>",[25,489,490,491,303,494,474],{"style":411},"        \u003Casp:UpdatePanel ID=",[30,492,493],{"style":470},"\"UpdatePanel1\"",[30,495,307],{"style":470},[25,497,498],{"style":397},"            \u003CContentTemplate>",[25,500,501,502,303,505,507,508,511,512,515],{"style":411},"                 \u003Casp:Label ID=",[30,503,504],{"style":470},"\"lblName\"",[30,506,307],{"style":470}," CssClass=",[30,509,510],{"style":470},"\"lbl\""," Text=",[30,513,514],{"style":470},"\"\"",">\u003C\u002Fasp:Label>",[25,517,518,519,303,522,507,524,527,528,511,531,534],{"style":411},"                 \u003Casp:LinkButton ID=",[30,520,521],{"style":470},"\"lnkButton\"",[30,523,307],{"style":470},[30,525,526],{"style":470},"\"lnk\""," onclick=",[30,529,530],{"style":470},"\"lnkButton_Click\"",[30,532,533],{"style":470},"\"Update\"",">\u003C\u002Fasp:LinkButton>",[25,536,537],{"style":411},"            \u003C\u002FContentTemplate>        ",[25,539,540],{"style":397},"            \u003CTriggers> ",[25,542,543,544,547],{"style":411},"              \u003Casp:AsyncPostBackTrigger ControlID=",[30,545,546],{"style":470},"\"btnGo\""," \u002F>",[25,549,550],{"style":397},"            \u003C\u002FTriggers>",[25,552,553],{"style":411},"        \u003C\u002Fasp:UpdatePanel>",[25,555,556,557,303,560,562,563,474],{"style":411},"        \u003Casp:UpdateProgress ID=",[30,558,559],{"style":470},"\"UpdateProgress1\"",[30,561,307],{"style":470}," AssociatedUpdatePanelID=",[30,564,493],{"style":470},[25,566,567],{"style":397},"            \u003CProgressTemplate>",[25,569,570],{"style":411},"                Updating.",[25,572,573],{"style":397},"            \u003C\u002FProgressTemplate>",[25,575,576],{"style":411},"        \u003C\u002Fasp:UpdateProgress>",[25,578,579],{"style":411},"        \u003Cbr \u002F>",[25,581,579],{"style":397},[25,583,584,585,303,587,507,589,511,592,547],{"style":411},"        \u003Casp:Button ID=",[30,586,546],{"style":470},[30,588,307],{"style":470},[30,590,591],{"style":470},"\"btn\"",[30,593,594],{"style":470},"\"Go\"",[25,596,597],{"style":411},"    \u003C\u002Fform>",[25,599,600],{"style":397},"\u003C\u002Fbody>",[16,602,603],{},"Ajax and Web Service Example",[231,605,606,609,612,618],{},[234,607,608],{},"Script Callable Web Service",[234,610,611],{},"Proxies are automatically generated",[234,613,614,617],{},[30,615,616],{},"ScriptService"," Attribute",[234,619,620],{},"If the web service returns a complex type, the succeeded callback function receives a return value in the form of Javascript object that corresponds to the server type.",[12,622,623],{},"Web Service code (simple function that returns ‘Hello World’)",[231,625,626],{},[234,627,628,629,631],{},"Web Service has ",[30,630,616],{}," attribute",[389,633,294,635,294],{"style":634},"line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 82.54%; font-family: consolas, 'Courier New', courier, monospace; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: gray 1px solid; padding: 4px;",[389,636,294,637,294,644,294,647,294,650,294,657,294,662,294,664,294,666,294,669,294,677,294,687,294,690,294],{"style":394},[25,638,639,640,643],{"style":411},"[WebService(Namespace = ",[30,641,642],{"style":470},"\"http:\u002F\u002Ftempuri.org\u002F\"",")]",[25,645,646],{"style":397},"[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]",[25,648,649],{"style":411},"[System.Web.Script.Services.ScriptService]",[25,651,652,105,654,656],{"style":397},[30,653,401],{"style":400},[30,655,407],{"style":400}," MyWebService : System.Web.Services.WebService {",[25,658,415,659,661],{"style":397},[30,660,401],{"style":400}," MyWebService () {",[25,663,435],{"style":411},[25,665,438],{"style":397},[25,667,668],{"style":411},"    [WebMethod]",[25,670,415,671,105,673,676],{"style":397},[30,672,401],{"style":400},[30,674,675],{"style":400},"string"," HelloWorld() {",[25,678,679,680,105,683,686],{"style":411},"        ",[30,681,682],{"style":400},"return",[30,684,685],{"style":470},"\"Hello World\"",";",[25,688,689],{"style":397},"    }    ",[25,691,455],{"style":411},[292,693,694,695,294,796,294],{},"  \nPage Code (page with button which calls js function, which in turn calls the web service defined within ScriptManager-ScriptReference tag)  \n",[389,696,294,698,294],{"style":697},"line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 86.21%; font-family: consolas, 'Courier New', courier, monospace; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: gray 1px solid; padding: 4px;",[389,699,294,700,294,707,294,714,294,717,294,722,294,725,294,728,294,745,294,751,294,753,294,756,294,759,294,762,294,764,294,767,294,770,294,772,294,774,294,777,294,780,294,782,294,785,294,787,294,790,294,793,294],{"style":394},[25,701,702,703,303,705,474],{"style":397},"\u003Cform id=",[30,704,471],{"style":470},[30,706,307],{"style":470},[25,708,709,710,303,712,474],{"style":411},"    \u003Casp:ScriptManager ID=",[30,711,480],{"style":470},[30,713,307],{"style":470},[25,715,716],{"style":397},"        \u003CServices>",[25,718,719,720,547],{"style":411},"            \u003Casp:ServiceReference Path=",[30,721,340],{"style":470},[25,723,724],{"style":397},"        \u003C\u002FServices>        ",[25,726,727],{"style":411},"    \u003C\u002Fasp:ScriptManager>",[25,729,730,731,303,734,507,736,511,738,741,742,547],{"style":397},"    \u003Casp:Button ID=",[30,732,733],{"style":470},"\"btnGet\"",[30,735,307],{"style":470},[30,737,591],{"style":470},[30,739,740],{"style":470},"\"Get\""," OnClientClick=",[30,743,744],{"style":470},"\"update();return false\"",[25,746,747,748,474],{"style":397},"    \u003Cscript type=",[30,749,750],{"style":470},"\"text\u002Fjavascript\"",[25,752,438],{"style":411},[25,754,755],{"style":397},"        function update() {",[25,757,758],{"style":411},"            MyWebService.HelloWorld(onCompleted, onFailed);",[25,760,761],{"style":397},"        }",[25,763,438],{"style":411},[25,765,766],{"style":397},"        function onCompleted(result, context, methodName) {",[25,768,769],{"style":411},"            alert(result);",[25,771,761],{"style":397},[25,773,438],{"style":411},[25,775,776],{"style":397},"        function onFailed(err, context, methodName) {",[25,778,779],{"style":411},"            alert(err.get_message());",[25,781,761],{"style":397},[25,783,784],{"style":397},"    \u003C\u002Fscript>",[25,786,438],{"style":411},[25,788,789],{"style":397},"\u003C\u002Fform>",[25,791,792],{"style":411},"dy>",[25,794,795],{"style":397},"ml>",[16,797,438],{},[16,799,800],{},"Page Method Example",[231,802,803,806],{},[234,804,805],{},"Allows javascript Ajax call back to page without web service",[234,807,808],{},"use EnablePageMethods=true in the ScriptManager control",[292,810,811],{},"  \nThe following is a sample showing a code behind static method marked with WebMethod attribute.  \n",[292,813,294,814,896,897,294,900,294],{},[389,815,294,817,294],{"style":816},"line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 86.84%; font-family: consolas, 'Courier New', courier, monospace; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: gray 1px solid; padding: 4px;",[389,818,294,819,294,830,294,834,294,844,294,848,294,853,294,857,294,861,294,866,294,881,294,888,294,892,294],{"style":394},[25,820,821],{"style":397},[16,822,823,105,825,105,827,829],{},[30,824,401],{"style":400},[30,826,404],{"style":400},[30,828,407],{"style":400}," PageMethod : System.Web.UI.Page",[25,831,832],{"style":411},[16,833,412],{},[25,835,836],{"style":397},[16,837,415,838,105,840,422,842,426],{},[30,839,418],{"style":400},[30,841,421],{"style":400},[30,843,425],{"style":400},[25,845,846],{"style":411},[16,847,429],{},[25,849,850],{"style":397},[16,851,852],{},"        Response.Write(DateTime.Now.ToString());",[25,854,855],{"style":411},[16,856,435],{},[25,858,859],{"style":397},[16,860,438],{},[25,862,863],{"style":411},[16,864,865],{},"    [System.Web.Services.WebMethod]",[25,867,868],{"style":397},[16,869,415,870,105,872,105,875,877,878,880],{},[30,871,401],{"style":400},[30,873,874],{"style":400},"static",[30,876,675],{"style":400}," update(",[30,879,675],{"style":400}," input){",[25,882,883],{"style":411},[16,884,679,885,887],{},[30,886,682],{"style":400}," input.ToUpper();",[25,889,890],{"style":397},[16,891,435],{},[25,893,894],{"style":411},[16,895,455],{},"  \nAspx code with a button that calls javascript, which in turn calls the page method ‘update’ to return uppercase string",[16,898,899],{},".",[389,901,294,903,294],{"style":902},"line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 88.59%; font-family: consolas, 'Courier New', courier, monospace; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: gray 1px solid; padding: 4px;",[389,904,294,905,294,925,294,942,294,958,294,969,294,980,294,1001,294,1034,294,1072,294,1076,294,1093,294,1102,294,1114,294,1126,294,1139,294,1147,294,1157,294,1165,294,1172,294,1180,294,1190,294,1200,294,1210,294],{"style":394},[25,906,907],{"style":397},[16,908,909,912,105,916,920,923],{},[30,910,911],{"style":400},"\u003C",[30,913,915],{"style":914},"color: #800000;","html",[30,917,919],{"style":918},"color: #ff0000;","xmlns",[30,921,922],{"style":400},"=\"http:\u002F\u002Fwww.w3.org\u002F1999\u002Fxhtml\"",[30,924,474],{"style":400},[25,926,927],{"style":411},[16,928,929,931,105,934,937,940],{},[30,930,911],{"style":400},[30,932,933],{"style":914},"head",[30,935,936],{"style":918},"runat",[30,938,939],{"style":400},"=\"server\"",[30,941,474],{"style":400},[25,943,944],{"style":397},[16,945,415,946,948,951,954,956],{},[30,947,911],{"style":400},[30,949,950],{"style":914},"title",[30,952,953],{"style":400},">\u003C\u002F",[30,955,950],{"style":914},[30,957,474],{"style":400},[25,959,960],{"style":411},[16,961,962,965,967],{},[30,963,964],{"style":400},"\u003C\u002F",[30,966,933],{"style":914},[30,968,474],{"style":400},[25,970,971],{"style":397},[16,972,973,975,978],{},[30,974,911],{"style":400},[30,976,977],{"style":914},"body",[30,979,474],{"style":400},[25,981,982],{"style":411},[16,983,415,984,986,105,989,992,105,995,997,999],{},[30,985,911],{"style":400},[30,987,988],{"style":914},"form",[30,990,991],{"style":918},"id",[30,993,994],{"style":400},"=\"form1\"",[30,996,936],{"style":918},[30,998,939],{"style":400},[30,1000,474],{"style":400},[25,1002,1003],{"style":411},[16,1004,415,1005,1007,105,1010,1013,105,1016,1018,105,1020,1023,105,1026,1029,105,1031],{},[30,1006,911],{"style":400},[30,1008,1009],{"style":914},"asp:ScriptManager",[30,1011,1012],{"style":918},"ID",[30,1014,1015],{"style":400},"=\"ScriptManager1\"",[30,1017,936],{"style":918},[30,1019,939],{"style":400},[30,1021,1022],{"style":918},"EnablePartialRendering",[30,1024,1025],{"style":400},"=\"true\"",[30,1027,1028],{"style":918},"EnablePageMethods",[30,1030,1025],{"style":400},[30,1032,1033],{"style":400},"\u002F>",[25,1035,1036],{"style":397},[16,1037,415,1038,1040,105,1043,1045,105,1048,1050,105,1052,1055,105,1058,1061,105,1064,1067,105,1070],{},[30,1039,911],{"style":400},[30,1041,1042],{"style":914},"asp:Button",[30,1044,1012],{"style":918},[30,1046,1047],{"style":400},"=\"btnGet\"",[30,1049,936],{"style":918},[30,1051,939],{"style":400},[30,1053,1054],{"style":918},"CssClass",[30,1056,1057],{"style":400},"=\"btn\"",[30,1059,1060],{"style":918},"Text",[30,1062,1063],{"style":400},"=\"Get\"",[30,1065,1066],{"style":918},"OnClientClick",[30,1068,1069],{"style":400},"=\"update();return false\"",[30,1071,1033],{"style":400},[25,1073,1074],{"style":411},[16,1075,438],{},[25,1077,1078],{"style":397},[16,1079,679,1080,1082,105,1085,1088,1091],{},[30,1081,911],{"style":400},[30,1083,1084],{"style":914},"script",[30,1086,1087],{"style":918},"type",[30,1089,1090],{"style":400},"=\"text\u002Fjavascript\"",[30,1092,474],{"style":400},[25,1094,1095],{"style":397},[16,1096,1097,1101],{},[30,1098,1100],{"style":1099},"color: #606060;","   1:","  ",[25,1103,1104],{"style":411},[16,1105,1106,1109,1110,1113],{},[30,1107,1108],{"style":1099},"   2:","             ",[30,1111,1112],{"style":400},"function"," update() {",[25,1115,1116],{"style":397},[16,1117,1118,1121,1122,1125],{},[30,1119,1120],{"style":1099},"   3:","                 PageMethods.update(",[30,1123,1124],{"style":470},"\"test\"",", onCompleted);",[25,1127,1128],{"style":411},[16,1129,1130,1133,1134,105,1136,686],{},[30,1131,1132],{"style":1099},"   4:","                 ",[30,1135,682],{"style":400},[30,1137,1138],{"style":400},"false",[25,1140,1141],{"style":397},[16,1142,1143,1146],{},[30,1144,1145],{"style":1099},"   5:","             }",[25,1148,1149],{"style":411},[16,1150,1151,1109,1154,1156],{},[30,1152,1153],{"style":1099},"   6:",[30,1155,1112],{"style":400}," onCompleted(result) {",[25,1158,1159],{"style":397},[16,1160,1161,1164],{},[30,1162,1163],{"style":1099},"   7:","                 alert(result.toString());",[25,1166,1167],{"style":411},[16,1168,1169,1146],{},[30,1170,1171],{"style":1099},"   8:",[25,1173,1174],{"style":397},[16,1175,1176,1179],{},[30,1177,1178],{"style":1099},"   9:","         ",[25,1181,1182],{"style":397},[16,1183,1184,1186,1188],{},[30,1185,964],{"style":400},[30,1187,1084],{"style":914},[30,1189,474],{"style":400},[25,1191,1192],{"style":397},[16,1193,415,1194,1196,1198],{},[30,1195,964],{"style":400},[30,1197,988],{"style":914},[30,1199,474],{"style":400},[25,1201,1202],{"style":411},[16,1203,1204,1206,1208],{},[30,1205,964],{"style":400},[30,1207,977],{"style":914},[30,1209,474],{"style":400},[25,1211,1212],{"style":397},[16,1213,1214,1216,1218],{},[30,1215,964],{"style":400},[30,1217,915],{"style":914},[30,1219,474],{"style":400},[16,1221,438],{},[16,1223,1224],{},"HTTP Requests (from Javascript) Sample",[292,1226,294,1227],{},[231,1228,1229,1232],{},[234,1230,1231],{},"The async communication layer enables javascript to make a request over the network to any http end point by using Sys.Net.WebRequest class",[234,1233,1234],{},"The sample performs a post and get http request from javascript",[292,1236,1237,1238,1350,1351,1883,1884,1957,1958,294],{},"  \nPage code that initiates the javascript call GetWebRequest().  \n",[389,1239,294,1241,294],{"style":1240},"line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 86.48%; font-family: consolas, 'Courier New', courier, monospace; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: gray 1px solid; padding: 4px;",[389,1242,294,1243,294,1251,294,1255,294,1263,294,1268,294,1276,294,1281,294,1286,294,1290,294,1308,294,1325,294,1329,294,1338,294,1342,294,1346,294],{"style":394},[25,1244,1245],{"style":397},[16,1246,702,1247,303,1249,474],{},[30,1248,471],{"style":470},[30,1250,307],{"style":470},[25,1252,1253],{"style":411},[16,1254,438],{},[25,1256,1257],{"style":397},[16,1258,298,1259,303,1261,474],{},[30,1260,480],{"style":470},[30,1262,307],{"style":470},[25,1264,1265],{"style":411},[16,1266,1267],{},"    \u003CScripts>",[25,1269,1270],{"style":397},[16,1271,1272,1273,547],{},"        \u003Casp:ScriptReference Path=",[30,1274,1275],{"style":470},"\"~\u002Fconnect.js\"",[25,1277,1278],{"style":411},[16,1279,1280],{},"    \u003C\u002FScripts>",[25,1282,1283],{"style":397},[16,1284,1285],{},"\u003C\u002Fasp:ScriptManager>",[25,1287,1288],{"style":411},[16,1289,438],{},[25,1291,1292],{"style":411},[16,1293,1294,1295,303,1297,507,1299,511,1301,1304,1305,547],{},"\u003Casp:Button ID=",[30,1296,546],{"style":470},[30,1298,307],{"style":470},[30,1300,591],{"style":470},[30,1302,1303],{"style":470},"\"GetWebRequest\"","  OnClientClick=",[30,1306,1307],{"style":470},"\"GetWebRequest();return false;\"",[25,1309,1310],{"style":397},[16,1311,1294,1312,303,1315,507,1317,511,1319,741,1322,547],{},[30,1313,1314],{"style":470},"\"btnPost\"",[30,1316,307],{"style":470},[30,1318,591],{"style":470},[30,1320,1321],{"style":470},"\"PostWebRequest\"",[30,1323,1324],{"style":470},"\"PostWebRequest();return false;\"",[25,1326,1327],{"style":411},[16,1328,438],{},[25,1330,1331],{"style":397},[16,1332,1333,1334,1337],{},"\u003Cdiv id=",[30,1335,1336],{"style":470},"\"result\"",">initial content\u003C\u002Fdiv>",[25,1339,1340],{"style":411},[16,1341,438],{},[25,1343,1344],{"style":397},[16,1345,438],{},[25,1347,1348],{"style":411},[16,1349,789],{},"  \nJavascript (connect.js) file which performs the webrequest  \n",[389,1352,294,1354,294],{"style":1353},"line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 87.69%; font-family: consolas, 'Courier New', courier, monospace; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: gray 1px solid; padding: 4px;",[389,1355,294,1356,294,1364,294,1368,294,1373,294,1377,294,1382,294,1390,294,1394,294,1398,294,1403,294,1412,294,1419,294,1428,294,1435,294,1443,294,1450,294,1454,294,1461,294,1469,294,1476,294,1481,294,1488,294,1495,294,1499,294,1506,294,1511,294,1515,294,1519,294,1526,294,1531,294,1538,294,1542,294,1548,294,1554,294,1558,294,1564,294,1571,294,1578,294,1582,294,1588,294,1595,294,1599,294,1606,294,1610,294,1614,294,1621,294,1626,294,1633,294,1638,294,1647,294,1652,294,1656,294,1662,294,1668,294,1672,294,1678,294,1683,294,1687,294,1691,294,1695,294,1702,294,1709,294,1716,294,1721,294,1729,294,1736,294,1743,294,1747,294,1754,294,1759,294,1772,294,1784,294,1788,294,1795,294,1803,294,1810,294,1814,294,1821,294,1828,294,1832,294,1839,294,1844,294,1851,294,1856,294,1860,294,1864,294,1868,294],{"style":394},[25,1357,1358],{"style":397},[30,1359,1361],{"style":1360},"color: #008000;",[16,1362,1363],{},"\u002F\u002F connect.js",[25,1365,1366],{"style":411},[16,1367,438],{},[25,1369,1370],{"style":397},[16,1371,1372],{},"var resultElement;",[25,1374,1375],{"style":411},[16,1376,438],{},[25,1378,1379],{"style":397},[16,1380,1381],{},"function pageLoad() {",[25,1383,1384],{"style":411},[16,1385,1386,1387,1389],{},"    resultElement = $get(",[30,1388,1336],{"style":470},");    ",[25,1391,1392],{"style":397},[16,1393,455],{},[25,1395,1396],{"style":411},[16,1397,438],{},[25,1399,1400],{"style":397},[16,1401,1402],{},"function GetWebRequest() {",[25,1404,1405],{"style":411},[16,1406,1407,1408,1411],{},"    alert(",[30,1409,1410],{"style":470},"\"performing web request\"",");",[25,1413,1414],{"style":411},[16,1415,415,1416],{},[30,1417,1418],{"style":1360},"\u002F\u002F Instantiate a WebRequest.",[25,1420,1421],{"style":397},[16,1422,1423,1424,1427],{},"    var wRequest = ",[30,1425,1426],{"style":400},"new"," Sys.Net.WebRequest();",[25,1429,1430],{"style":397},[16,1431,415,1432],{},[30,1433,1434],{"style":1360},"\u002F\u002F Set the request URL.      ",[25,1436,1437],{"style":411},[16,1438,1439,1440,1411],{},"    wRequest.set_url(",[30,1441,1442],{"style":470},"\"getTarget.htm\"",[25,1444,1445],{"style":397},[16,1446,1407,1447,1411],{},[30,1448,1449],{"style":470},"\"Target Url: getTarget.htm\"",[25,1451,1452],{"style":411},[16,1453,438],{},[25,1455,1456],{"style":397},[16,1457,415,1458],{},[30,1459,1460],{"style":1360},"\u002F\u002F Set the request verb.",[25,1462,1463],{"style":411},[16,1464,1465,1466,1411],{},"    wRequest.set_httpVerb(",[30,1467,1468],{"style":470},"\"GET\"",[25,1470,1471],{"style":411},[16,1472,415,1473],{},[30,1474,1475],{"style":1360},"\u002F\u002F Set the request callback function.",[25,1477,1478],{"style":397},[16,1479,1480],{},"    wRequest.add_completed(OnWebRequestCompleted);",[25,1482,1483],{"style":397},[16,1484,415,1485],{},[30,1486,1487],{"style":1360},"\u002F\u002F Clear the results area.",[25,1489,1490],{"style":411},[16,1491,1492,1493,686],{},"    resultElement.innerHTML = ",[30,1494,514],{"style":470},[25,1496,1497],{"style":397},[16,1498,438],{},[25,1500,1501],{"style":411},[16,1502,415,1503],{},[30,1504,1505],{"style":1360},"\u002F\u002F Execute the request.",[25,1507,1508],{"style":397},[16,1509,1510],{},"    wRequest.invoke();      ",[25,1512,1513],{"style":411},[16,1514,455],{},[25,1516,1517],{"style":397},[16,1518,438],{},[25,1520,1521],{"style":411},[30,1522,1523],{"style":1360},[16,1524,1525],{},"\u002F\u002F This function performs a POST Web request.",[25,1527,1528],{"style":397},[16,1529,1530],{},"function PostWebRequest() {",[25,1532,1533],{"style":411},[16,1534,1407,1535,1411],{},[30,1536,1537],{"style":470},"\"Performing Post Web request.\"",[25,1539,1540],{"style":397},[16,1541,438],{},[25,1543,1544],{"style":411},[16,1545,415,1546],{},[30,1547,1418],{"style":1360},[25,1549,1550],{"style":397},[16,1551,1423,1552,1427],{},[30,1553,1426],{"style":400},[25,1555,1556],{"style":411},[16,1557,438],{},[25,1559,1560],{"style":397},[16,1561,415,1562],{},[30,1563,1434],{"style":1360},[25,1565,1566],{"style":411},[16,1567,1439,1568,1411],{},[30,1569,1570],{"style":470},"\"postTarget.aspx\"",[25,1572,1573],{"style":397},[16,1574,1407,1575,1411],{},[30,1576,1577],{"style":470},"\"Target Url: postTarget.aspx\"",[25,1579,1580],{"style":411},[16,1581,438],{},[25,1583,1584],{"style":397},[16,1585,415,1586],{},[30,1587,1460],{"style":1360},[25,1589,1590],{"style":411},[16,1591,1465,1592,1411],{},[30,1593,1594],{"style":470},"\"POST\"",[25,1596,1597],{"style":397},[16,1598,438],{},[25,1600,1601],{"style":411},[16,1602,415,1603],{},[30,1604,1605],{"style":1360},"\u002F\u002F Set the request handler.",[25,1607,1608],{"style":397},[16,1609,1480],{},[25,1611,1612],{"style":411},[16,1613,438],{},[25,1615,1616],{"style":397},[16,1617,415,1618],{},[30,1619,1620],{"style":1360},"\u002F\u002F Set the body for he POST.",[25,1622,1623],{"style":411},[16,1624,1625],{},"    var requestBody =",[25,1627,1628],{"style":397},[16,1629,679,1630,686],{},[30,1631,1632],{"style":470},"\"Message=Hello! Do you hear me?\"",[25,1634,1635],{"style":411},[16,1636,1637],{},"    wRequest.set_body(requestBody);",[25,1639,1640],{"style":397},[16,1641,1642,1643,1646],{},"    wRequest.get_headers()[",[30,1644,1645],{"style":470},"\"Content-Length\"","] =",[25,1648,1649],{"style":411},[16,1650,1651],{},"        requestBody.length;",[25,1653,1654],{"style":397},[16,1655,438],{},[25,1657,1658],{"style":411},[16,1659,415,1660],{},[30,1661,1487],{"style":1360},[25,1663,1664],{"style":397},[16,1665,1492,1666,686],{},[30,1667,514],{"style":470},[25,1669,1670],{"style":411},[16,1671,438],{},[25,1673,1674],{"style":397},[16,1675,415,1676],{},[30,1677,1505],{"style":1360},[25,1679,1680],{"style":411},[16,1681,1682],{},"    wRequest.invoke();",[25,1684,1685],{"style":397},[16,1686,455],{},[25,1688,1689],{"style":411},[16,1690,438],{},[25,1692,1693],{"style":397},[16,1694,438],{},[25,1696,1697],{"style":411},[30,1698,1699],{"style":1360},[16,1700,1701],{},"\u002F\u002F This callback function processes the ",[25,1703,1704],{"style":397},[30,1705,1706],{"style":1360},[16,1707,1708],{},"\u002F\u002F request return values. It is called asynchronously ",[25,1710,1711],{"style":411},[30,1712,1713],{"style":1360},[16,1714,1715],{},"\u002F\u002F by the current executor.",[25,1717,1718],{"style":397},[16,1719,1720],{},"function OnWebRequestCompleted(executor, eventArgs) {",[25,1722,1723],{"style":411},[16,1724,415,1725,1728],{},[30,1726,1727],{"style":400},"if"," (executor.get_responseAvailable()) {",[25,1730,1731],{"style":397},[16,1732,679,1733],{},[30,1734,1735],{"style":1360},"\u002F\u002F Clear the previous results. ",[25,1737,1738],{"style":411},[16,1739,1740,1741,686],{},"        resultElement.innerHTML = ",[30,1742,514],{"style":470},[25,1744,1745],{"style":397},[16,1746,438],{},[25,1748,1749],{"style":411},[16,1750,679,1751],{},[30,1752,1753],{"style":1360},"\u002F\u002F Display Web request status. ",[25,1755,1756],{"style":397},[16,1757,1758],{},"        resultElement.innerHTML +=",[25,1760,1761],{"style":411},[16,1762,1763,1764,1767,1768,1771],{},"          ",[30,1765,1766],{"style":470},"\"Status: [\""," + executor.get_statusCode() + ",[30,1769,1770],{"style":470},"\" \""," +",[25,1773,1774],{"style":397},[16,1775,1776,1777,1780,1781,686],{},"                    executor.get_statusText() + ",[30,1778,1779],{"style":470},"\"]\""," + ",[30,1782,1783],{"style":470},"\"\u003Cbr\u002F>\"",[25,1785,1786],{"style":411},[16,1787,438],{},[25,1789,1790],{"style":397},[16,1791,679,1792],{},[30,1793,1794],{"style":1360},"\u002F\u002F Display Web request headers.",[25,1796,1797],{"style":411},[16,1798,1799,1800,686],{},"        resultElement.innerHTML += ",[30,1801,1802],{"style":470},"\"Headers: \"",[25,1804,1805],{"style":397},[16,1806,1807,1808,686],{},"        resultElement.innerHTML += executor.getAllResponseHeaders() + ",[30,1809,1783],{"style":470},[25,1811,1812],{"style":411},[16,1813,438],{},[25,1815,1816],{"style":397},[16,1817,679,1818],{},[30,1819,1820],{"style":1360},"\u002F\u002F Display Web request body.",[25,1822,1823],{"style":411},[16,1824,1758,1825,686],{},[30,1826,1827],{"style":470},"\"Body:\"",[25,1829,1830],{"style":397},[16,1831,438],{},[25,1833,1834],{"style":411},[16,1835,679,1836,1838],{},[30,1837,1727],{"style":400}," (document.all)",[25,1840,1841],{"style":397},[16,1842,1843],{},"            resultElement.innerText += executor.get_responseData();",[25,1845,1846],{"style":411},[16,1847,679,1848],{},[30,1849,1850],{"style":400},"else",[25,1852,1853],{"style":397},[16,1854,1855],{},"            resultElement.textContent += executor.get_responseData();",[25,1857,1858],{"style":411},[16,1859,435],{},[25,1861,1862],{"style":397},[16,1863,438],{},[25,1865,1866],{"style":411},[16,1867,455],{},[25,1869,1870],{"style":397},[16,1871,1872,1874,1875,1878,1879,1882],{},[30,1873,1727],{"style":400}," (",[30,1876,1877],{"style":400},"typeof"," (Sys) !== ",[30,1880,1881],{"style":470},"\"undefined\"",") Sys.Application.notifyScriptLoaded();","  \nTarget Html file used in the Get  \n",[389,1885,294,1887,294],{"style":1886},"line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 88.16%; font-family: consolas, 'Courier New', courier, monospace; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: gray 1px solid; padding: 4px;",[389,1888,294,1889,294,1900,294,1909,294,1914,294,1919,294,1924,294,1928,294,1933,294,1938,294,1943,294,1948,294,1952,294],{"style":394},[25,1890,1891],{"style":397},[16,1892,1893,1894,105,1897,474],{},"\u003C!DOCTYPE html PUBLIC ",[30,1895,1896],{"style":470},"\"-\u002F\u002FW3C\u002F\u002FDTD XHTML 1.0 Transitional\u002F\u002FEN\"",[30,1898,1899],{"style":470},"\"http:\u002F\u002Fwww.w3.org\u002FTR\u002Fxhtml1\u002FDTD\u002Fxhtml1-transitional.dtd\"",[25,1901,1902],{"style":411},[16,1903,1904,1905,1908],{},"\u003Chtml xmlns=",[30,1906,1907],{"style":470},"\"http:\u002F\u002Fwww.w3.org\u002F1999\u002Fxhtml\""," >",[25,1910,1911],{"style":397},[16,1912,1913],{},"\u003Chead>",[25,1915,1916],{"style":411},[16,1917,1918],{},"    \u003Ctitle>Hello Page\u003C\u002Ftitle>",[25,1920,1921],{"style":397},[16,1922,1923],{},"\u003C\u002Fhead>",[25,1925,1926],{"style":411},[16,1927,464],{},[25,1929,1930],{"style":397},[16,1931,1932],{},"    \u003Cp> ",[25,1934,1935],{"style":411},[16,1936,1937],{},"        Hello there. ",[25,1939,1940],{"style":397},[16,1941,1942],{},"        I got your GET Web request!",[25,1944,1945],{"style":411},[16,1946,1947],{},"    \u003C\u002Fp>",[25,1949,1950],{"style":397},[16,1951,600],{},[25,1953,1954],{"style":411},[16,1955,1956],{},"\u003C\u002Fhtml>","  \nPost Aspx Page  \n",[389,1959,294,1960,294],{"style":902},[389,1961,294,1962,294,1974,294,1978,294,1986,294,1990,294,1996,294,2006,294,2011,294,2020,294,2030,294,2035,294,2051,294,2056,294,2064,294,2068,294,2072,294,2076,294,2080,294,2084,294,2092,294,2097,294,2102,294,2107,294,2116,294,2125,294,2130,294,2135,294,2140,294,2144,294,2148,294],{"style":394},[25,1963,1964],{"style":397},[16,1965,1966,1967,1970,1971,1973],{},"\u003C%@ Page Language=",[30,1968,1969],{"style":470},"\"C#\""," AutoEventWireup=",[30,1972,486],{"style":470},"  %>",[25,1975,1976],{"style":411},[16,1977,438],{},[25,1979,1980],{"style":397},[16,1981,1893,1982,105,1984,474],{},[30,1983,1896],{"style":470},[30,1985,1899],{"style":470},[25,1987,1988],{"style":411},[16,1989,438],{},[25,1991,1992],{"style":397},[16,1993,1904,1994,1908],{},[30,1995,1907],{"style":470},[25,1997,1998],{"style":411},[16,1999,2000,2001,303,2004,474],{},"\u003Chead id=",[30,2002,2003],{"style":470},"\"Head1\"",[30,2005,307],{"style":470},[25,2007,2008],{"style":397},[16,2009,2010],{},"    \u003Ctitle>Post Target\u003C\u002Ftitle>",[25,2012,2013],{"style":397},[16,2014,2015,2016,303,2018,474],{},"    \u003Cscript language=",[30,2017,1969],{"style":470},[30,2019,307],{"style":470},[25,2021,2022],{"style":397},[16,2023,679,2024,105,2026,422,2028,426],{},[30,2025,418],{"style":400},[30,2027,421],{"style":400},[30,2029,425],{"style":400},[25,2031,2032],{"style":411},[16,2033,2034],{},"        {",[25,2036,2037],{"style":397},[16,2038,2039,2040,2042,2043,2046,2047,2050],{},"            ",[30,2041,1727],{"style":400}," (HttpContext.Current.Request.Form[",[30,2044,2045],{"style":470},"\"Message\"","] != ",[30,2048,2049],{"style":400},"null",")",[25,2052,2053],{"style":411},[16,2054,2055],{},"                LabelID.Text = ",[25,2057,2058],{"style":397},[16,2059,2060,2061,2063],{},"                    HttpContext.Current.Request.Form[",[30,2062,2045],{"style":470},"].ToString();",[25,2065,2066],{"style":411},[16,2067,761],{},[25,2069,2070],{"style":411},[16,2071,784],{},[25,2073,2074],{"style":397},[16,2075,438],{},[25,2077,2078],{"style":411},[16,2079,1923],{},[25,2081,2082],{"style":397},[16,2083,464],{},[25,2085,2086],{"style":411},[16,2087,467,2088,303,2090,474],{},[30,2089,471],{"style":470},[30,2091,307],{"style":470},[25,2093,2094],{"style":397},[16,2095,2096],{},"    \u003Cdiv>",[25,2098,2099],{"style":411},[16,2100,2101],{},"        \u003Ch1>WebRequestPost Target\u003C\u002Fh1>",[25,2103,2104],{"style":411},[16,2105,2106],{},"        \u003Cp>",[25,2108,2109],{"style":397},[16,2110,2111,2112,2115],{},"            \u003Casp:Textbox id=",[30,2113,2114],{"style":470},"\"LabelID\"","  ",[25,2117,2118],{"style":411},[16,2119,2120,2121,303,2123,1033],{},"                Text=",[30,2122,1124],{"style":470},[30,2124,307],{"style":470},[25,2126,2127],{"style":397},[16,2128,2129],{},"        \u003C\u002Fp>",[25,2131,2132],{"style":397},[16,2133,2134],{},"        Yes, I got your POST Web request!",[25,2136,2137],{"style":397},[16,2138,2139],{},"    \u003C\u002Fdiv>",[25,2141,2142],{"style":411},[16,2143,597],{},[25,2145,2146],{"style":397},[16,2147,600],{},[25,2149,2150],{"style":411},[16,2151,1956],{},[182,2153],{"style":2154,"src":2155,"alt":185},"display: none;","\u002Farticles\u002Fimages\u002Fajax.png",{"title":185,"searchDepth":188,"depth":188,"links":2157},[],"2015-04-20T08:07:16.5000000-04:00","There are many options within the Microsoft stack of products for AJAX type functionality.  The following article covers the primary mechanisms that utilize the Microsoft out of the box Ajax functionality.  Ajax must be one of the technologies used in all current web applications.  The primary benefit is the improved user experience by providing quick, responsive feedback. Core features include Ajax Client Libraries and Ajax Server Controls.",{},"\u002Farticles\u002Fmicrosoft-ajax-features-and-implementation-samples",{"title":218,"description":2159},"articles\u002Fmicrosoft-ajax-features-and-implementation-samples",[2165],"aspnet","z4UUBACfZQdvJHc_1kqU_wGEoJgjO1kJ2Q4ROa2yb4M",{"id":2168,"title":2169,"author":7,"body":2170,"createdAt":3143,"description":3144,"extension":192,"img":3140,"meta":3145,"navigation":194,"path":3146,"seo":3147,"stem":3148,"tags":3149,"updatedAt":3143,"__hash__":3151},"articles\u002Farticles\u002Fexport-sql-data-to-microsoft-excel-using-visual-studio-2008-c.md","Export SQL Data to Microsoft Excel (using Visual Studio 2008, c#)",{"type":9,"value":2171,"toc":3141},[2172,2181,2196,2300,2369,2372,2400,2503,2631,2865,3016,3081,3138],[12,2173,2174,2175,2177,2178,2180],{},"Over the years there have been a number of methods to move SQL data into Microsoft Excel.  Using Automation you can call methods and properties that are specific to excel which gives you the greatest flexibility for specifying the location of your data in the workbook.  The following are two recent approaches to export Sql Server table row data to an excel workbook. ",[42,2176],{},"\n1.) Using Automation you can use transfer data cell by cell",[42,2179],{},"\n2.) Transfer data in an array to a range of cells",[12,2182,2183,2184,2186,2187,2189,2190,2192,2193,2195],{},"I created a WPF application with a button \"Export\" for this code.  The click event creates performs the the following actions",[42,2185],{},"\na.) Gets a reference to the automation object\nb.) Adds a default workbook\nc.) Gets the list of tables within the database\nd.) Gets data\ne.) Exports the data to excel worksheets (there are 2 methods defined (1) range method (2) cell by cell\nf.) Saves the excel sheet\ng.) Clean up",[42,2188],{},"\n ",[42,2191],{},"\nThis blog posts shows two ways to extract data from SQL Server and place into an Excel document. The Range method was much quicker than the cell by cell approach.  The code below gets a list of all tables within a particular SQL Database and exports the data to Excel. ",[42,2194],{},"\nI didn’t use was Excel 2007 document format at this.  If you have a good post or web link using this technique I would happily reference.  Let me know if you would like the Visual Studio project.",[389,2197,294,2200,294],{"id":2198,"style":2199},"codeSnippetWrapper","text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[389,2201,294,2204,294,294,2216,294,294,2223,294,294,2225,294,294,2228,294,294,2233,294,294,2235,294,294,2240,294,294,2243,294,294,2245,294,105,294,2248,294,294,2253,294,294,2258,294,294,2265,294,294,2267,294,294,2272,294,105,294,2277,294,294,2286,294,294,2289,294,294,2292,294,294,2298,294],{"id":2202,"style":2203},"codeSnippet","text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,2205,2207,105,2210,2212,2213,2215],{"style":2206},"text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[30,2208,2209],{"style":400},"private",[30,2211,421],{"style":400}," btnExport_Click(",[30,2214,425],{"style":400}," sender, RoutedEventArgs e) {",[25,2217,2219,2220,686],{"style":2218},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;","    lblMessage.Content=",[30,2221,2222],{"style":470},"\"Export Started..\"",[25,2224,438],{"style":2206},[25,2226,2227],{"style":2218},"    WpfApplication.DoEvents();",[25,2229,2230,2231,1411],{"style":2206},"    ApplicationClass app = CreateExcelDocument(",[30,2232,1138],{"style":400},[25,2234,438],{"style":2218},[25,2236,415,2237],{"style":2206},[30,2238,2239],{"style":1360},"\u002F\u002Fadd workbook to excel document",[25,2241,2242],{"style":2218},"    Workbook workbook = app.Workbooks.Add(Type.Missing);",[25,2244,438],{"style":2206},[25,2246,2247],{"style":2218},"    DataSet ds = GetData(GetTableList());            ",[25,2249,415,2250],{"style":2218},[30,2251,2252],{"style":1360},"\u002F\u002Fshown below are 2 method of moving data from sql to excel, only use one of them",[25,2254,415,2255],{"style":2206},[30,2256,2257],{"style":1360},"\u002F\u002F(1)call method to export to worksheet using range functionality (much faster than cell by cell method",[25,2259,2260,2261,2264],{"style":2218},"    Export(ds, ",[30,2262,2263],{"style":400},"ref"," workbook);",[25,2266,438],{"style":2206},[25,2268,415,2269],{"style":2218},[30,2270,2271],{"style":1360},"\u002F\u002F(2)cell by cell method",[25,2273,415,2274],{"style":2206},[30,2275,2276],{"style":1360},"\u002F\u002FInsertIntoExcel(app, ds);",[25,2278,2279,2280,2282,2283,686],{"style":2206},"     ",[30,2281,675],{"style":400}," fileName = ",[30,2284,2285],{"style":470},"@\"C:\\Safety3.xlsx\"",[25,2287,2288],{"style":2218},"     SaveDoc(workbook, fileName);",[25,2290,2291],{"style":2206},"     CloseExcelDocument(app);",[25,2293,2294,2295,686],{"style":2218},"     lblMessage.Content = ",[30,2296,2297],{"style":470},"\"Finished..\"",[25,2299,455],{"style":2206},[389,2301,294,2302,294],{"id":2198,"style":2199},[389,2303,294,2304,294,294,2309,294,294,2314,294,294,2319,294,294,2328,294,294,2333,294,294,2339,294,294,2345,294,294,2348,294,294,2350,294,294,2357,294,294,2360,294,294,2362,294,294,2367,294],{"id":2202,"style":2203},[25,2305,2306],{"style":2206},[30,2307,2308],{"style":1360},"\u002F\u002F\u002F \u003Csummary>",[25,2310,2311],{"style":2218},[30,2312,2313],{"style":1360},"\u002F\u002F\u002F creates excel document",[25,2315,2316],{"style":2206},[30,2317,2318],{"style":1360},"\u002F\u002F\u002F \u003C\u002Fsummary>",[25,2320,2321,2323,2324,2327],{"style":2218},[30,2322,2209],{"style":400}," ApplicationClass CreateExcelDocument(",[30,2325,2326],{"style":400},"bool"," visible) {",[25,2329,2330,2331,686],{"style":2206},"    ApplicationClass app = ",[30,2332,2049],{"style":400},[25,2334,415,2335,2338],{"style":2218},[30,2336,2337],{"style":400},"try"," {",[25,2340,2341,2342,2344],{"style":2206},"        app = ",[30,2343,1426],{"style":400}," Microsoft.Office.Interop.Excel.ApplicationClass();",[25,2346,2347],{"style":2218},"        app.Visible = visible;",[25,2349,438],{"style":2206},[25,2351,2352,2353,2356],{"style":2218},"    } ",[30,2354,2355],{"style":400},"catch"," (Exception ex) {",[25,2358,2359],{"style":2206},"        MessageBox.Show(ex.ToString());",[25,2361,435],{"style":2218},[25,2363,415,2364,2366],{"style":2206},[30,2365,682],{"style":400}," app;",[25,2368,455],{"style":2218},[12,2370,2371],{},"c.) The following method GetTableList() returns a List\u003CExportInfo> where ExportInfo is a structure that has the Name and SQL to be used for each table to be exported.",[389,2373,294,2374,294],{"id":2198},[389,2375,294,2377,294,294,2384,294,294,2391,294,294,2398,294],{"id":2202,"style":2376},"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 63px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,2378,2379,105,2381,2383],{"style":2206},[30,2380,401],{"style":400},[30,2382,407],{"style":400}," ExportInfo {",[25,2385,415,2386,105,2388,2390],{"style":2218},[30,2387,401],{"style":400},[30,2389,675],{"style":400}," Name { get; set; }",[25,2392,415,2393,105,2395,2397],{"style":2206},[30,2394,401],{"style":400},[30,2396,675],{"style":400}," Sql { get; set; }",[25,2399,455],{"style":2218},[389,2401,294,2403,294],{"id":2198,"style":2402},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 324px; max-height: 350px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[389,2404,294,2405,294,294,2409,294,294,2414,294,294,2418,294,294,2423,294,294,2428,294,294,2437,294,105,294,2446,294,294,2449,294,294,2455,294,294,2458,294,294,2461,294,294,2464,294,294,2466,294,294,2468,294,294,2474,294,294,2484,294,294,2494,294,294,2496,294,294,2501,294],{"id":2202,"style":2203},[25,2406,2407],{"style":2206},[30,2408,2308],{"style":1360},[25,2410,2411],{"style":2218},[30,2412,2413],{"style":1360},"\u002F\u002F\u002F get list of sql tables in database",[25,2415,2416],{"style":2206},[30,2417,2318],{"style":1360},[25,2419,2420],{"style":2218},[30,2421,2422],{"style":1360},"\u002F\u002F\u002F \u003Creturns>list of ExportInfo objects\u003C\u002Freturns>",[25,2424,2425,2427],{"style":2206},[30,2426,2209],{"style":400}," List\u003CExportInfo> GetTableList() {",[25,2429,2430,2431,2433,2434,1411],{"style":2218},"    System.Data.DataTable tables = ",[30,2432,1426],{"style":400}," System.Data.DataTable(",[30,2435,2436],{"style":470},"\"Tables\"",[25,2438,415,2439,2442,2443,2445],{"style":2206},[30,2440,2441],{"style":400},"using"," (SqlConnection connection = ",[30,2444,1426],{"style":400}," SqlConnection(GetConnectionString())) {",[25,2447,2448],{"style":2206},"        SqlCommand command = connection.CreateCommand();",[25,2450,2451,2452,686],{"style":2218},"        command.CommandText = ",[30,2453,2454],{"style":470},"\"select table_name as Name from INFORMATION_SCHEMA.tables where TABLE_TYPE = 'BASE TABLE'\"",[25,2456,2457],{"style":2206},"        connection.Open();",[25,2459,2460],{"style":2218},"        tables.Load(command.ExecuteReader(CommandBehavior.CloseConnection));",[25,2462,2463],{"style":2206},"        connection.Close();",[25,2465,435],{"style":2218},[25,2467,438],{"style":2206},[25,2469,2470,2471,2473],{"style":2218},"    List\u003CExportInfo> exps = ",[30,2472,1426],{"style":400}," List\u003CExportInfo>();",[25,2475,415,2476,2479,2480,2483],{"style":2206},[30,2477,2478],{"style":400},"foreach"," (DataRow row ",[30,2481,2482],{"style":400},"in"," tables.Rows) {",[25,2485,2486,2487,2489,2490,2493],{"style":2218},"        exps.Add(",[30,2488,1426],{"style":400}," ExportInfo(){Name=row[0].ToString(), Sql = String.Format(",[30,2491,2492],{"style":470},"\"select top 1 * from {0}\"",",row[0].ToString())});",[25,2495,435],{"style":2206},[25,2497,415,2498,2500],{"style":2218},[30,2499,682],{"style":400}," exps;            ",[25,2502,455],{"style":2206},[389,2504,294,2506,294],{"id":2198,"style":2505},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 247px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[389,2507,294,2508,294,294,2512,294,294,2517,294,294,2521,294,294,2526,294,294,2531,294,294,2536,294,294,2542,294,294,2550,294,294,2558,294,294,2564,294,294,2566,294,294,2568,294,294,2573,294,294,2579,294,294,2585,294,294,2589,294,294,2592,294,294,2596,294,294,2598,294,294,2600,294,294,2602,294,294,2608,294,294,2616,294,294,2619,294,294,2622,294,294,2624,294,294,2629,294],{"id":2202,"style":2203},[25,2509,2510],{"style":2206},[30,2511,2308],{"style":1360},[25,2513,2514],{"style":2218},[30,2515,2516],{"style":1360},"\u002F\u002F\u002F get data from sql server",[25,2518,2519],{"style":2206},[30,2520,2318],{"style":1360},[25,2522,2523],{"style":2218},[30,2524,2525],{"style":1360},"\u002F\u002F\u002F \u003Cparam name=\"exps\">\u003C\u002Fparam>",[25,2527,2528],{"style":2206},[30,2529,2530],{"style":1360},"\u002F\u002F\u002F \u003Creturns>dataset with return results\u003C\u002Freturns>",[25,2532,2533,2535],{"style":2218},[30,2534,2209],{"style":400}," System.Data.DataSet GetData(List\u003CExportInfo> exps) {",[25,2537,2538,2539,2541],{"style":2206},"    DataSet ds = ",[30,2540,1426],{"style":400}," DataSet();",[25,2543,415,2544,2546,2547,2549],{"style":2218},[30,2545,675],{"style":400}," executeSql = ",[30,2548,675],{"style":400},".Empty;",[25,2551,415,2552,2554,2555,2557],{"style":2206},[30,2553,2478],{"style":400}," (ExportInfo exp ",[30,2556,2482],{"style":400}," exps) {",[25,2559,2560,2561,686],{"style":2218},"        executeSql += exp.Sql + ",[30,2562,2563],{"style":470},"\";\"",[25,2565,435],{"style":2206},[25,2567,438],{"style":2218},[25,2569,415,2570,2572],{"style":2206},[30,2571,675],{"style":400}," connectionString = GetConnectionString();",[25,2574,2575,2576,2578],{"style":2218},"    SqlConnection conn = ",[30,2577,1426],{"style":400}," SqlConnection(connectionString);",[25,2580,2581,2582,2584],{"style":2206},"    SqlDataAdapter adapter = ",[30,2583,1426],{"style":400}," SqlDataAdapter(executeSql, conn);",[25,2586,415,2587,2338],{"style":2218},[30,2588,2337],{"style":400},[25,2590,2591],{"style":2206},"        adapter.Fill(ds);",[25,2593,2352,2594,2356],{"style":2218},[30,2595,2355],{"style":400},[25,2597,438],{"style":2206},[25,2599,435],{"style":2218},[25,2601,438],{"style":2206},[25,2603,415,2604,2607],{"style":2218},[30,2605,2606],{"style":400},"int"," index = 0;",[25,2609,415,2610,2612,2613,2615],{"style":2206},[30,2611,2478],{"style":400}," (System.Data.DataTable dt ",[30,2614,2482],{"style":400}," ds.Tables) {",[25,2617,2618],{"style":2218},"        dt.TableName = exps[index].Name;",[25,2620,2621],{"style":2206},"        index += 1;",[25,2623,435],{"style":2218},[25,2625,415,2626,2628],{"style":2206},[30,2627,682],{"style":400}," ds;",[25,2630,455],{"style":2218},[389,2632,294,2634,294],{"id":2198,"style":2633},"text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 500px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;",[389,2635,294,2636,294,294,2640,294,294,2645,294,294,2649,294,294,2654,294,294,2659,294,294,2669,294,294,2671,294,294,2676,294,294,2678,294,294,2683,294,294,2690,294,294,2692,294,294,2697,294,294,2707,294,294,2709,294,294,2714,294,294,2722,294,294,2725,294,294,2727,294,294,2729,294,294,2734,294,294,2740,294,294,2747,294,294,2750,294,294,2753,294,294,2755,294,294,2757,294,294,2762,294,294,2769,294,294,2777,294,294,2782,294,294,2784,294,294,2789,294,294,2792,294,294,2795,294,294,2797,294,294,2799,294,294,2802,294,294,2805,294,294,2807,294,294,2812,294,294,2815,294,294,2818,294,294,2820,294,294,2826,294,294,2828,294,294,2833,294,294,2845,294,294,2848,294,294,2850,294,294,2855,294,294,2861,294,294,2863,294],{"id":2202,"style":2203},[25,2637,2638],{"style":2206},[30,2639,2308],{"style":1360},[25,2641,2642],{"style":2218},[30,2643,2644],{"style":1360},"\u002F\u002F\u002F Copy data from dataset into workbook",[25,2646,2647],{"style":2206},[30,2648,2318],{"style":1360},[25,2650,2651],{"style":2218},[30,2652,2653],{"style":1360},"\u002F\u002F\u002F \u003Cparam name=\"dataSet\">\u003C\u002Fparam>",[25,2655,2656],{"style":2206},[30,2657,2658],{"style":1360},"\u002F\u002F\u002F \u003Cparam name=\"excelWorkbook\">\u003C\u002Fparam>        ",[25,2660,2661,105,2663,2665,2666,2668],{"style":2218},[30,2662,2209],{"style":400},[30,2664,421],{"style":400}," Export(DataSet dataSet, ",[30,2667,2263],{"style":400}," Workbook excelWorkbook) {",[25,2670,438],{"style":2206},[25,2672,415,2673,2675],{"style":2218},[30,2674,2606],{"style":400}," sheetIndex = 0;",[25,2677,438],{"style":2206},[25,2679,415,2680],{"style":2218},[30,2681,2682],{"style":1360},"\u002F\u002F build rawData 2 dimensional array with data for each datatable            ",[25,2684,415,2685,2612,2687,2689],{"style":2206},[30,2686,2478],{"style":400},[30,2688,2482],{"style":400}," dataSet.Tables) {",[25,2691,438],{"style":2218},[25,2693,679,2694],{"style":2206},[30,2695,2696],{"style":1360},"\u002F\u002F Copy the DataTable to an object array",[25,2698,679,2699,2701,2702,105,2704,2706],{"style":2218},[30,2700,425],{"style":400},"[,] data = ",[30,2703,1426],{"style":400},[30,2705,425],{"style":400},"[dt.Rows.Count + 1, dt.Columns.Count];",[25,2708,438],{"style":2206},[25,2710,679,2711],{"style":2218},[30,2712,2713],{"style":1360},"\u002F\u002F Copy the column names to the first row of the object array",[25,2715,679,2716,1874,2719,2721],{"style":2206},[30,2717,2718],{"style":400},"for",[30,2720,2606],{"style":400}," col = 0; col \u003C dt.Columns.Count; col++) {",[25,2723,2724],{"style":2218},"            data[0, col] = dt.Columns[col].ColumnName;",[25,2726,761],{"style":2206},[25,2728,438],{"style":2218},[25,2730,679,2731],{"style":2206},[30,2732,2733],{"style":1360},"\u002F\u002F Copy the values to the object array",[25,2735,679,2736,1874,2738,2721],{"style":2218},[30,2737,2718],{"style":400},[30,2739,2606],{"style":400},[25,2741,2039,2742,1874,2744,2746],{"style":2206},[30,2743,2718],{"style":400},[30,2745,2606],{"style":400}," row = 0; row \u003C dt.Rows.Count; row++) {",[25,2748,2749],{"style":2218},"                data[row + 1, col] = dt.Rows[row].ItemArray[col];",[25,2751,2752],{"style":2206},"            }",[25,2754,761],{"style":2218},[25,2756,438],{"style":2206},[25,2758,679,2759],{"style":2218},[30,2760,2761],{"style":1360},"\u002F\u002F Calculate the final column letter",[25,2763,679,2764,2766,2767,2549],{"style":2206},[30,2765,675],{"style":400}," finalColLetter = ",[30,2768,675],{"style":400},[25,2770,679,2771,2773,2774,686],{"style":2218},[30,2772,675],{"style":400}," colCharset = ",[30,2775,2776],{"style":470},"\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"",[25,2778,679,2779,2781],{"style":2206},[30,2780,2606],{"style":400}," colCharsetLen = colCharset.Length;",[25,2783,438],{"style":2218},[25,2785,679,2786,2788],{"style":2206},[30,2787,1727],{"style":400}," (dt.Columns.Count > colCharsetLen) {",[25,2790,2791],{"style":2218},"            finalColLetter = colCharset.Substring(",[25,2793,2794],{"style":2206},"                (dt.Columns.Count - 1) \u002F colCharsetLen - 1, 1);",[25,2796,761],{"style":2218},[25,2798,438],{"style":2206},[25,2800,2801],{"style":2218},"        finalColLetter += colCharset.Substring(",[25,2803,2804],{"style":2206},"                (dt.Columns.Count - 1) % colCharsetLen, 1);",[25,2806,438],{"style":2218},[25,2808,679,2809],{"style":2206},[30,2810,2811],{"style":1360},"\u002F\u002F Create a new Sheet",[25,2813,2814],{"style":2218},"        Worksheet excelSheet = (Worksheet)excelWorkbook.Sheets.Add(excelWorkbook.Sheets.get_Item(++sheetIndex),",[25,2816,2817],{"style":2206},"                                                                    Type.Missing, 1, XlSheetType.xlWorksheet);",[25,2819,438],{"style":2218},[25,2821,2822,2823],{"style":2206},"        excelSheet.Name = dt.TableName; ",[30,2824,2825],{"style":1360},"\u002F\u002F name new sheet name of table",[25,2827,438],{"style":2218},[25,2829,679,2830],{"style":2206},[30,2831,2832],{"style":1360},"\u002F\u002F Fast data export to Excel",[25,2834,679,2835,2837,2838,2840,2841,2844],{"style":2218},[30,2836,675],{"style":400}," excelRange = ",[30,2839,675],{"style":400},".Format(",[30,2842,2843],{"style":470},"\"A1:{0}{1}\"",", finalColLetter, dt.Rows.Count + 1);",[25,2846,2847],{"style":2206},"        excelSheet.get_Range(excelRange, Type.Missing).Value2 = data;",[25,2849,438],{"style":2218},[25,2851,679,2852],{"style":2206},[30,2853,2854],{"style":1360},"\u002F\u002F Mark the first row as BOLD",[25,2856,2857,2858,686],{"style":2218},"        ((Range)excelSheet.Rows[1, Type.Missing]).Font.Bold = ",[30,2859,2860],{"style":400},"true",[25,2862,435],{"style":2206},[25,2864,455],{"style":2218},[389,2866,294,2867,294],{"id":2198,"style":2199},[389,2868,294,2869,294,294,2873,294,294,2878,294,294,2882,294,294,2887,294,294,2892,294,294,2899,294,294,2905,294,294,2908,294,294,2911,294,294,2913,294,294,2918,294,294,2923,294,294,2930,294,105,294,2934,294,294,2937,294,294,2945,294,294,2948,294,294,2951,294,294,2953,294,294,2955,294,294,2958,294,294,2965,294,294,2968,294,294,2971,294,294,2978,294,294,2981,294,294,2984,294,294,2987,294,294,2989,294,294,2994,294,294,2996,294,294,3007,294,294,3009,294,294,3014,294],{"id":2202,"style":2203},[25,2870,2871],{"style":2206},[30,2872,2308],{"style":1360},[25,2874,2875],{"style":2218},[30,2876,2877],{"style":1360},"\u002F\u002F\u002F inserts data into excel row by row",[25,2879,2880],{"style":2206},[30,2881,2318],{"style":1360},[25,2883,2884],{"style":2218},[30,2885,2886],{"style":1360},"\u002F\u002F\u002F \u003Cparam name=\"excel\">\u003C\u002Fparam>",[25,2888,2889],{"style":2206},[30,2890,2891],{"style":1360},"\u002F\u002F\u002F \u003Cparam name=\"ds\">\u003C\u002Fparam>",[25,2893,2894,105,2896,2898],{"style":2218},[30,2895,2209],{"style":400},[30,2897,421],{"style":400}," InsertIntoExcel(Microsoft.Office.Interop.Excel.Application excel, System.Data.DataSet ds) {",[25,2900,415,2901,2612,2903,2615],{"style":2206},[30,2902,2478],{"style":400},[30,2904,2482],{"style":400},[25,2906,2907],{"style":2218},"        Microsoft.Office.Interop.Excel.Worksheet theSheet = (Microsoft.Office.Interop.Excel.Worksheet)excel.Workbooks[1].Worksheets.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing);",[25,2909,2910],{"style":2206},"        theSheet.Name = dt.TableName;",[25,2912,438],{"style":2218},[25,2914,679,2915,2917],{"style":2206},[30,2916,2606],{"style":400}," colIndex = 0;",[25,2919,679,2920,2922],{"style":2218},[30,2921,2606],{"style":400}," rowIndex = 1;",[25,2924,679,2925,2927,2928,2549],{"style":2206},[30,2926,675],{"style":400}," err = ",[30,2929,675],{"style":400},[25,2931,679,2932,2338],{"style":2218},[30,2933,2337],{"style":400},[25,2935,2936],{"style":2218},"            colIndex = 0;",[25,2938,2039,2939,2941,2942,2944],{"style":2206},[30,2940,2478],{"style":400}," (DataColumn col ",[30,2943,2482],{"style":400}," dt.Columns) {",[25,2946,2947],{"style":2218},"                colIndex += 1;",[25,2949,2950],{"style":2206},"                excel.Cells[1, colIndex] = col.ColumnName;",[25,2952,2752],{"style":2218},[25,2954,438],{"style":2206},[25,2956,2957],{"style":2218},"            rowIndex = 1;",[25,2959,2039,2960,2479,2962,2964],{"style":2206},[30,2961,2478],{"style":400},[30,2963,2482],{"style":400}," dt.Rows) {",[25,2966,2967],{"style":2218},"                rowIndex += 1;",[25,2969,2970],{"style":2206},"                colIndex = 0;",[25,2972,2973,2974,2941,2976,2944],{"style":2218},"                ",[30,2975,2478],{"style":400},[30,2977,2482],{"style":400},[25,2979,2980],{"style":2206},"                    colIndex += 1;",[25,2982,2983],{"style":2218},"                    excel.Cells[rowIndex, colIndex] = row[col.ColumnName].ToString();",[25,2985,2986],{"style":2206},"                }",[25,2988,2752],{"style":2218},[25,2990,2991,2992,2356],{"style":2206},"        } ",[30,2993,2355],{"style":400},[25,2995,438],{"style":2218},[25,2997,2998,2999,3002,3003,3006],{"style":2206},"            err += ",[30,3000,3001],{"style":470},"\"RowIndex=\""," + rowIndex.ToString() + ",[30,3004,3005],{"style":470},"\" ColIndex=\""," + colIndex.ToString();",[25,3008,761],{"style":2218},[25,3010,2352,3011],{"style":2206},[30,3012,3013],{"style":1360},"\u002F\u002F next ",[25,3015,455],{"style":2218},[389,3017,294,3018,294],{"id":2198},[389,3019,294,3021,294,294,3025,294,294,3030,294,294,3034,294,294,3039,294,294,3044,294,294,3054,294,294,3059,294,294,3062,294,294,3065,294,294,3068,294,294,3074,294,294,3079,294],{"id":2202,"style":3020},"text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 207px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;",[25,3022,3023],{"style":2206},[30,3024,2308],{"style":1360},[25,3026,3027],{"style":2218},[30,3028,3029],{"style":1360},"\u002F\u002F\u002F Save workbook to file system",[25,3031,3032],{"style":2206},[30,3033,2318],{"style":1360},[25,3035,3036],{"style":2218},[30,3037,3038],{"style":1360},"\u002F\u002F\u002F \u003Cparam name=\"excelWorkbook\">\u003C\u002Fparam>",[25,3040,3041],{"style":2206},[30,3042,3043],{"style":1360},"\u002F\u002F\u002F \u003Cparam name=\"fileName\">\u003C\u002Fparam>",[25,3045,3046,105,3048,3050,3051,3053],{"style":2218},[30,3047,2209],{"style":400},[30,3049,421],{"style":400}," SaveDoc(Workbook excelWorkbook, ",[30,3052,675],{"style":400}," fileName) {",[25,3055,415,3056],{"style":2206},[30,3057,3058],{"style":1360},"\u002F\u002F Save and Close the Workbook",[25,3060,3061],{"style":2218},"    excelWorkbook.SaveAs(fileName, XlFileFormat.xlWorkbookNormal, Type.Missing,",[25,3063,3064],{"style":2206},"        Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlExclusive,",[25,3066,3067],{"style":2218},"        Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);",[25,3069,3070,3071,3073],{"style":2206},"    excelWorkbook.Close(",[30,3072,2860],{"style":400},", Type.Missing, Type.Missing);",[25,3075,3076,3077,686],{"style":2218},"    excelWorkbook = ",[30,3078,2049],{"style":400},[25,3080,455],{"style":2206},[389,3082,294,3083,294],{"id":2198},[389,3084,294,3085,294,294,3089,294,294,3094,294,294,3098,294,294,3103,294,294,3110,294,294,3115,294,294,3118,294,294,3123,294,294,3125,294,294,3130,294,294,3133,294,294,3136,294],{"id":2202,"style":3020},[25,3086,3087],{"style":2206},[30,3088,2308],{"style":1360},[25,3090,3091],{"style":2218},[30,3092,3093],{"style":1360},"\u002F\u002F\u002F Clean up and close document",[25,3095,3096],{"style":2206},[30,3097,2318],{"style":1360},[25,3099,3100],{"style":2218},[30,3101,3102],{"style":1360},"\u002F\u002F\u002F \u003Cparam name=\"excelApp\">\u003C\u002Fparam>",[25,3104,3105,105,3107,3109],{"style":2206},[30,3106,2209],{"style":400},[30,3108,421],{"style":400}," CloseExcelDocument(ApplicationClass excelApp) {",[25,3111,415,3112],{"style":2218},[30,3113,3114],{"style":1360},"\u002F\u002F Release the Application object",[25,3116,3117],{"style":2206},"    excelApp.Quit();",[25,3119,3120,3121,686],{"style":2218},"    excelApp = ",[30,3122,2049],{"style":400},[25,3124,438],{"style":2206},[25,3126,415,3127],{"style":2218},[30,3128,3129],{"style":1360},"\u002F\u002F Collect the unreferenced objects",[25,3131,3132],{"style":2206},"    GC.Collect();",[25,3134,3135],{"style":2218},"    GC.WaitForPendingFinalizers();",[25,3137,455],{"style":2206},[182,3139],{"style":2154,"src":3140,"alt":185},"\u002Farticles\u002Fimages\u002Fexport.jpg",{"title":185,"searchDepth":188,"depth":188,"links":3142},[],"2015-04-20T08:07:16.2600000-04:00","How to migrate data to Excel.",{},"\u002Farticles\u002Fexport-sql-data-to-microsoft-excel-using-visual-studio-2008-c",{"title":2169,"description":3144},"articles\u002Fexport-sql-data-to-microsoft-excel-using-visual-studio-2008-c",[3150],"sql","WrTKgWupiJpRf38vBT1Ecbke8nc6PFnUO6TDGtQ-kK8",1781574768499]