<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8072873846125946515</id><updated>2012-02-16T11:38:56.955-08:00</updated><title type='text'>VB .Net Developer</title><subtitle type='html'>This blog is about web site development technology including VB.Net, ASP.Net, Service Oriented Architecture (SOA), database development, CSS, AJAX, web service and Javascript.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-4830626469593043036</id><published>2009-05-11T13:10:00.001-07:00</published><updated>2009-05-11T13:46:29.728-07:00</updated><title type='text'>10 - Passing user input to backend using Ajax</title><content type='html'>In previous article, we can successfully make use of the Ajax technique to retrieve data from database and create new UI element in Web page with Ajax. In this article we will try to pass some user input to data access layer so that it can be used as parameter to retrieve data or it can be save in database.&lt;br /&gt;&lt;br /&gt;1. Open the DemoADL project and modify the DemoDB.vb as following&lt;br /&gt;&lt;br /&gt;======================================&lt;br /&gt;Imports System.Data.SqlClient&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Public Class DemoDB&lt;br /&gt;&lt;br /&gt;    Public sDiscountType As String&lt;br /&gt;    Public sStoreID As String&lt;br /&gt;&lt;br /&gt;    Public iPageNo As Integer = 1&lt;br /&gt;    Public iPageSize As Integer = 3&lt;br /&gt;&lt;br /&gt;    Public arrDiscount As New List(Of DemoDB)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Public Function GetRecords() As DemoDB&lt;br /&gt;&lt;br /&gt;        'Dim dbConnection As SqlConnection&lt;br /&gt;        'Dim sqlCommand As SqlCommand&lt;br /&gt;        'Dim dr As SqlDataReader&lt;br /&gt;&lt;br /&gt;        'dbConnection = New SqlConnection("server=localhost;Trusted_Connection=true;database=pubs")&lt;br /&gt;        'Try&lt;br /&gt;        '    dbConnection.Open()&lt;br /&gt;        '    sqlCommand = New SqlCommand("Select * from discounts", dbConnection)&lt;br /&gt;        '    dr = sqlCommand.ExecuteReader()&lt;br /&gt;        '    Dim i As Integer&lt;br /&gt;        '    i = 0&lt;br /&gt;        '    While dr.Read()&lt;br /&gt;        '        i = i + 1&lt;br /&gt;        '        Dim newRec As New DemoDB()&lt;br /&gt;        '        arrDiscount.Add(newRec)&lt;br /&gt;        '        newRec.sDiscountType = dr(0).ToString()&lt;br /&gt;        '        newRec.sStoreID = dr(1).ToString()&lt;br /&gt;        '    End While&lt;br /&gt;        '    dr.Close()&lt;br /&gt;        '    dbConnection.Close()&lt;br /&gt;        'Catch e As Exception&lt;br /&gt;        'End Try&lt;br /&gt;&lt;br /&gt;        'Return Me&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        Try&lt;br /&gt;            Dim i As Integer&lt;br /&gt;            i = 0&lt;br /&gt;            While i &lt; iPageSize&lt;br /&gt;                i = i + 1&lt;br /&gt;                Dim newRec As New DemoDB()&lt;br /&gt;                arrDiscount.Add(newRec)&lt;br /&gt;                newRec.sDiscountType = "Test Discount Type " &amp; i.ToString &amp; "  at Page No " &amp; iPageNo&lt;br /&gt;                newRec.sStoreID = "Test Store ID " &amp; i.ToString&lt;br /&gt;            End While&lt;br /&gt;        Catch e As Exception&lt;br /&gt;        End Try&lt;br /&gt;&lt;br /&gt;        Return Me&lt;br /&gt;&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;======================================&lt;br /&gt;&lt;br /&gt;Compile this project.&lt;br /&gt;&lt;br /&gt;2. Open the Service project using VWD 2008 express edition and update the DemoDAL.dll reference by right click the dll in the solution window and click Update Reference menu.&lt;br /&gt;&lt;br /&gt;3. Double click the Service.vb and change the web service as following.&lt;br /&gt;&lt;br /&gt;====================================&lt;br /&gt;&lt;br /&gt;Imports System.Web&lt;br /&gt;Imports System.Web.Services&lt;br /&gt;Imports System.Web.Services.Protocols&lt;br /&gt;Imports DemoDAL.DemoDAL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.&lt;br /&gt;' &lt;System.Web.Script.Services.ScriptService()&gt; _&lt;br /&gt;&lt;WebService(Namespace:="http://DemoService.org/")&gt; _&lt;br /&gt;&lt;WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&gt; _&lt;br /&gt;&lt;Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()&gt; _&lt;br /&gt;Public Class Service&lt;br /&gt;    Inherits System.Web.Services.WebService&lt;br /&gt;&lt;br /&gt;    &lt;WebMethod()&gt; _&lt;br /&gt;    Public Function HelloWorld() As String&lt;br /&gt;        Return "Hello World"&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;    &lt;WebMethod()&gt; _&lt;br /&gt;    Public Function SayHelloFromDAL() As String&lt;br /&gt;        Dim obj As New DemoDAL.DemoDAL()&lt;br /&gt;        Return obj.SayHello()&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;    &lt;WebMethod()&gt; _&lt;br /&gt;    Public Function GetRecords(ByRef obj As DemoDAL.DemoDB) As DemoDAL.DemoDB&lt;br /&gt;        Return obj.GetRecords()&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;====================================&lt;br /&gt;&lt;br /&gt;The web service method GetRecords now accept a DemoDB object as a ByRef parameter. Therefore any change at DAL layer will be returned to the caller.&lt;br /&gt;Compile the web service project and restart the web service by press F5 key.&lt;br /&gt;&lt;br /&gt;4. Now open the ServiceAgent project using VB 2008 express edition. Update the Service reference to the Service we just started in step 3. Now double click the ServiceAgent.vb and change the code as following.&lt;br /&gt;&lt;br /&gt;======================================&lt;br /&gt;&lt;br /&gt;Imports ServiceAgent.DemoWebService&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Public Class ServiceAgent&lt;br /&gt;&lt;br /&gt;    Public Function HelloFromServiceAgent()&lt;br /&gt;        Dim obj As DemoWebService.ServiceSoapClient&lt;br /&gt;        obj = New DemoWebService.ServiceSoapClient()&lt;br /&gt;        Return obj.SayHelloFromDAL()&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;    Public Function GetRecords(ByRef demoDB As DemoWebService.DemoDB) As DemoWebService.DemoDB&lt;br /&gt;        Dim obj As DemoWebService.ServiceSoapClient&lt;br /&gt;        obj = New DemoWebService.ServiceSoapClient()&lt;br /&gt;        obj.GetRecords(demoDB)&lt;br /&gt;        Return demoDB&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;======================================&lt;br /&gt;&lt;br /&gt;Similarly we are change the GetRecords function to accept DemoDB object as a ByRef parameter and call the web service with the DemoDB object.&lt;br /&gt;&lt;br /&gt;Now rebuild this project.&lt;br /&gt;&lt;br /&gt;5. Now open the DemoSite project using VWD 2008 and update the web service reference and the ServiceAgent reference. Then double click the Default.aspx.vb to modify the code that calls the GetRecord function and because DemoDB parameter is required by the function. We should call the GetRecords() function using following code.&lt;br /&gt;&lt;br /&gt;=============================&lt;br /&gt;&lt;br /&gt;        Dim obj As ServiceAgent.DemoWebService.ServiceSoapClient&lt;br /&gt;        obj = New ServiceAgent.DemoWebService.ServiceSoapClient()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        Dim records As New ServiceAgent.DemoWebService.DemoDB&lt;br /&gt;        records = obj.GetRecords(records)&lt;br /&gt;&lt;br /&gt;=============================&lt;br /&gt;&lt;br /&gt;6. Double click theWebSercieDemo.vb file in the solution window and modify the service proxy as following&lt;br /&gt;&lt;br /&gt;=========================&lt;br /&gt;    &lt;WebMethod()&gt; _&lt;br /&gt;    Public Function wsProxyGetRecords(ByVal records As ServiceAgent.DemoWebService.DemoDB) As ServiceAgent.DemoWebService.DemoDB&lt;br /&gt;&lt;br /&gt;        Dim obj As ServiceAgent.DemoWebService.ServiceSoapClient&lt;br /&gt;        obj = New ServiceAgent.DemoWebService.ServiceSoapClient()&lt;br /&gt;&lt;br /&gt;        'Dim records As ServiceAgent.DemoWebService.DemoDB&lt;br /&gt;        obj.GetRecords(records)&lt;br /&gt;&lt;br /&gt;        Return records&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;=========================&lt;br /&gt;&lt;br /&gt;7. Finally we need to change the code in javascript file to call the web service as following&lt;br /&gt;&lt;br /&gt;==================================&lt;br /&gt;&lt;br /&gt;function Getrecords() {&lt;br /&gt;&lt;br /&gt; var obj =&lt;br /&gt;         new ServiceAgent.DemoWebService.DemoDB();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; var pageNoContron = document.getElementById("TextBoxPageNo");&lt;br /&gt; if (pageNoContron != null) {&lt;br /&gt;  var pageNo = pageNoContron.value;&lt;br /&gt;  if (pageNo.length &gt; 0)&lt;br /&gt;   obj.iPageNo = pageNo;&lt;br /&gt;  else&lt;br /&gt;   obj.iPageNo = 1;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; var pageSizeContron = document.getElementById("TextBoxRecordPerPage");&lt;br /&gt; if (pageSizeContron != null) {&lt;br /&gt;  var pageSize = pageSizeContron.value;&lt;br /&gt;  if (pageSize.length &gt; 0)&lt;br /&gt;   obj.iPageSize = pageSize;&lt;br /&gt;  else&lt;br /&gt;   obj.iPageSize = 2;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; obj = WebServiceDemo.wsProxyGetRecords(obj, SucceededCallback_GetRecord, FailedCallback_GetRecord);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function SucceededCallback_GetRecord(obj) {&lt;br /&gt;&lt;br /&gt;    var example_div = document.createElement('div');&lt;br /&gt;    example_div.style.cssText =&lt;br /&gt;                        'margin: 3px; '&lt;br /&gt;                        + 'border: 1px solid black; '&lt;br /&gt;                        + 'background:' + '#bbbbbb' + '; '&lt;br /&gt;                        + 'color:' + '#000000'&lt;br /&gt;                ;&lt;br /&gt;&lt;br /&gt;    document.getElementById("form1").appendChild(example_div);&lt;br /&gt;&lt;br /&gt;    var currentTime = new Date();&lt;br /&gt;    var month = currentTime.getMonth() + 1;&lt;br /&gt;    var day = currentTime.getDate();&lt;br /&gt;    var year = currentTime.getFullYear();&lt;br /&gt;    var hour = currentTime.getHours();&lt;br /&gt;    var min = currentTime.getMinutes();&lt;br /&gt;    var sec = currentTime.getSeconds();   &lt;br /&gt;    &lt;br /&gt;    example_div.appendChild(document.createTextNode(obj.arrDiscount.length &lt;br /&gt;                + " records have been retrieved at " &lt;br /&gt;                + month + "/" + day + "/" + year&lt;br /&gt;                + "  "+hour&lt;br /&gt;                +" : "+min&lt;br /&gt;                + " : " + sec));&lt;br /&gt;                &lt;br /&gt;        for (var i = 0; i &lt; obj.arrDiscount.length; i++) &lt;br /&gt;        {&lt;br /&gt;            try &lt;br /&gt;            {&lt;br /&gt;                    var record_div = document.createElement('div');&lt;br /&gt;                    record_div.style.cssText =&lt;br /&gt;                                        'margin-left: 30px; '&lt;br /&gt;                                        + 'margin-top: 5px; '&lt;br /&gt;                                        + 'border: 1px solid black; '&lt;br /&gt;                                        + 'background:' + '#bbbbbb' + '; '&lt;br /&gt;                                        + 'color:' + '#006600'&lt;br /&gt;                                ;&lt;br /&gt;                    example_div.appendChild(record_div);&lt;br /&gt;                    record_div.appendChild(document.createTextNode(i+"  discount " + obj.arrDiscount[i].sDiscountType));&lt;br /&gt;            }&lt;br /&gt;            catch (e) &lt;br /&gt;            {&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function FailedCallback_GetRecord() {&lt;br /&gt; alert("GetRecords failed")&lt;br /&gt;}&lt;br /&gt;==================================&lt;br /&gt;&lt;br /&gt;In the javascript code, the user input of Page No. and page size is  retrieved from the page as user entry, and then passed to the web service. The value will also be passed back when the function finishes.&lt;br /&gt;&lt;br /&gt;8. After modifying the Default.aspx to include the controls to allow user entry as following&lt;br /&gt;&lt;br /&gt;==============================&lt;br /&gt;      &lt;asp:Label ID="Label1" runat="server" Text="Page No."&gt;&lt;/asp:Label&gt;&lt;/br&gt;&lt;br /&gt;      &lt;asp:TextBox ID="TextBoxPageNo" runat="server"&gt;&lt;/asp:TextBox&gt;&lt;br/&gt;&lt;br /&gt;      &lt;asp:Label ID="Label2" runat="server" Text="Records per page"&gt;&lt;/asp:Label&gt;&lt;/br&gt;&lt;br /&gt;      &lt;asp:TextBox ID="TextBoxRecordPerPage" runat="server"&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;==============================&lt;br /&gt;&lt;br /&gt;we can start the application.&lt;br /&gt;&lt;br /&gt;9. The final web page in browser will similar to following.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgiMcKLjNhI/AAAAAAAAAJc/2-YPjFyaitA/s1600-h/Pass+user+Value+through+Javascript+to+Backend.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 286px; height: 400px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgiMcKLjNhI/AAAAAAAAAJc/2-YPjFyaitA/s400/Pass+user+Value+through+Javascript+to+Backend.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5334668174017377810" /&gt;Get User Entry and Pass To Backend&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When user provides page No., Page Size and clicks the link to Get Record by Ajax, a new table will be added to the page using data retrieved from database with the parameter of Page No. and Page Size .&lt;br /&gt;&lt;br /&gt;The source code can be downloaded from &lt;a href="http://vb.ndprice.com/Tutorial_VB Part_10_User Entry Passed To backend.zip"&gt;Tutorial_VB Part_10_User Entry Passed To backend.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-4830626469593043036?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/4830626469593043036/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=4830626469593043036' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/4830626469593043036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/4830626469593043036'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/10-passing-user-input-to-backend-using.html' title='10 - Passing user input to backend using Ajax'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3LWYYeZTm30/SgiMcKLjNhI/AAAAAAAAAJc/2-YPjFyaitA/s72-c/Pass+user+Value+through+Javascript+to+Backend.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-7402018076498913015</id><published>2009-05-11T10:49:00.001-07:00</published><updated>2009-05-11T13:04:39.648-07:00</updated><title type='text'>Javascript Editor Freeze in Visual Web Developer 2008</title><content type='html'>I have noticed this problem for a little while. Sometimes when you double click a javascript file, the source editor window becomes not responsible. If you switch to any other source code, the editor just works fine.&lt;br /&gt;&lt;br /&gt;After search online, I found following article seemed to solve the problem.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/webdevtools/archive/2008/02/09/downloadable-hotfix-performance-and-editor-fixes-for-microsoft-visual-studio-2008-and-visual-web-developer-express-2008.aspx"&gt;Downloadable Hotfix: Performance and Editor fixes for Microsoft Visual Studio 2008 and Visual Web Developer Express 2008&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.wolffmyren.com/2008/02/11/performance-and-editor-fixes-for-vs2008/"&gt;Performance and Editor fixes for VS2008… &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I downloaded the hotfix and installed it. The problem seems resolved. The only problem is that the scroll bar does not seem work.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SghpG37k2bI/AAAAAAAAAJM/Ci6sifKmH6Q/s1600-h/VWDJavascriptEditorProblem.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 334px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SghpG37k2bI/AAAAAAAAAJM/Ci6sifKmH6Q/s400/VWDJavascriptEditorProblem.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5334629325434313138" /&gt;No Scroll Bar Available&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Follow instructions from Matt's blog, I verified that the Hotfix has been installed properly.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/Sghpz5jLTAI/AAAAAAAAAJU/ndBGCVt0eCU/s1600-h/VWDJavascriptEditorHotFixeInstalled.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 310px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/Sghpz5jLTAI/AAAAAAAAAJU/ndBGCVt0eCU/s400/VWDJavascriptEditorHotFixeInstalled.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5334630098962959362" /&gt;KB946581 Hotfix Installed&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Not sure the reason. I have just posted a question here &lt;a href="http://forums.asp.net/p/1421706/3155856.aspx#3155856"&gt;http://forums.asp.net/1112.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-7402018076498913015?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/7402018076498913015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=7402018076498913015' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7402018076498913015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7402018076498913015'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/javascript-editor-freeze-in-visual-web.html' title='Javascript Editor Freeze in Visual Web Developer 2008'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3LWYYeZTm30/SghpG37k2bI/AAAAAAAAAJM/Ci6sifKmH6Q/s72-c/VWDJavascriptEditorProblem.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-599394424837951235</id><published>2009-05-11T08:23:00.000-07:00</published><updated>2009-05-11T08:34:28.602-07:00</updated><title type='text'>VS2008 Color Schemes</title><content type='html'>I do not like the default VS2008 color schemes in Javascript editor, which is as following.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SghD1SaNOmI/AAAAAAAAAI0/XQ-yefIqBHU/s1600-h/DefaultScheme.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 337px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SghD1SaNOmI/AAAAAAAAAI0/XQ-yefIqBHU/s400/DefaultScheme.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5334588341374237282" /&gt;Default Javascript Editor Color Scheme&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Therefore I made some search online. The following is a good source for modification of color scheme.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://winterdom.com/2007/11/vs2008colorschemes"&gt;http://winterdom.com/2007/11/vs2008colorschemes&lt;/a&gt;&lt;br /&gt;&lt;a href="http://blogs.msdn.com/charlie/archive/2008/05/26/ide-color-schemes-for-the-vs-editor.aspx"&gt;&lt;br /&gt;http://blogs.msdn.com/charlie/archive/2008/05/26/ide-color-schemes-for-the-vs-editor.aspx&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I tried a few of them and the one called 2008-GardenOfEden looks to be my favorate. However, the Javascript editor does not look nice still. &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SghFCnoWRaI/AAAAAAAAAI8/AOiYbhMybPg/s1600-h/VS2008+Color+Schemes_GardenOfEden.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 291px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SghFCnoWRaI/AAAAAAAAAI8/AOiYbhMybPg/s400/VS2008+Color+Schemes_GardenOfEden.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5334589669920621986" /&gt;Javascript Color Scheme of Newly imported options&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I start wondering the javascript editor is not well developed because other than the color scheme problem, the window refresh of Javascript editor does not work sometimes as well. Maybe Microsoft can answer this question. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Anyway, I go to the Tools -&gt; Options and modified a few items (Trach change before save and track change after save), it looks better.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SghFTWMR0eI/AAAAAAAAAJE/xkO9cUj6KZM/s1600-h/VS2008+Color+Schemes_GardenOfEden_After+Change.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 337px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SghFTWMR0eI/AAAAAAAAAJE/xkO9cUj6KZM/s400/VS2008+Color+Schemes_GardenOfEden_After+Change.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5334589957297263074" /&gt;Modified Version&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I will stick with this one until I come across a better one some day later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-599394424837951235?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/599394424837951235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=599394424837951235' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/599394424837951235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/599394424837951235'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/vs2008-color-schemes.html' title='VS2008 Color Schemes'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3LWYYeZTm30/SghD1SaNOmI/AAAAAAAAAI0/XQ-yefIqBHU/s72-c/DefaultScheme.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-664172089092097288</id><published>2009-05-09T11:16:00.000-07:00</published><updated>2009-05-10T20:04:01.545-07:00</updated><title type='text'>9 - Ajax Demo</title><content type='html'>This article will start to explore the power of Javascript combined with Web Service.&lt;br /&gt;&lt;br /&gt;Ajax stands for Asynchronous JavaScript And XML. The main benefit of Ajax is that the data can be retrieved according to the user's actions and the web page can be refreshed partially by modifying existing user interface element such as text, image, adding new elements to the page, or removing some elements from the page. More introduction about Ajax can be found from &lt;a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29"&gt;http://en.wikipedia.org/wiki/Ajax_(programming)&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Before we continue with coding, we should understand the reason we need a service proxy as described in the &lt;a href="http://vbnetwork.blogspot.com/2009/05/create-service-oriented-web-site-using_07.html"&gt;article about architecture&lt;/a&gt;. Most web browsers generally do not allow Javascript to directly call web service from other web site. Therefore, in order to call our service agent or web service hosted in another website, such as &lt;a href="http://vbs.ndprice.com/service.asmx"&gt;http://vbs.ndprice.com/service.asmx&lt;/a&gt; from our website &lt;a href="http://vb.ndprice.com/default.aspx"&gt;http://vb.ndprice.com/default.aspx&lt;/a&gt;, we need create an service proxy at &lt;a href="http://vb.ndprice.com/WebServiceDemo.asmx"&gt;http://vb.ndprice.com/WebServiceDemo.asmx&lt;/a&gt;. The main purpose of the service proxy is to call the service from server side to another server and pass the result to the browser.&lt;br /&gt;&lt;br /&gt;There are more discussions in this article. &lt;a href="http://www.simple-talk.com/dotnet/asp.net/calling-cross-domain-web-services-in-ajax/"&gt;Calling Cross Domain Web Services in AJAX&lt;/a&gt;. Here we will simply use a server side proxy.&lt;br /&gt;&lt;br /&gt;Now lets start with our journey to create web page with some Ajax flavor.&lt;br /&gt;&lt;br /&gt;1. Make sure our web service is running by starting the Service project.&lt;br /&gt;&lt;br /&gt;2. Open the Demo Site project and right click the project in solution window, select Add New Item menu button. The following dialog will be popped up. Select the Web Service, type the web service name as WebServiceDemo.asmx and click OK, as following:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgXdLcZ9KEI/AAAAAAAAAIE/JpvxgjzneC8/s1600-h/Part9_1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 265px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgXdLcZ9KEI/AAAAAAAAAIE/JpvxgjzneC8/s400/Part9_1.jpg" alt="" id="BLOGGER_PHOTO_ID_5333912522363578434" border="0" /&gt;Add Service Prxy&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;3. Now doulbe click the WebServiceDemo.asmx file in the solution window and add new web service in the service proxy.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. Add a solution folder to the website by right clicking the website and selecting the add folder menu button, as following:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgX28V3m1fI/AAAAAAAAAIM/MUFEkdQFYt0/s1600-h/Part9_2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 325px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgX28V3m1fI/AAAAAAAAAIM/MUFEkdQFYt0/s400/Part9_2.jpg" alt="" id="BLOGGER_PHOTO_ID_5333940850213180914" border="0" /&gt;Add New Folder&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;5. Name the new folder as javascript, and right click the folder. In the pop up menu, select Add new Item as following:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgX3cnkBWcI/AAAAAAAAAIU/0VxW5bnRdg4/s1600-h/Part9_3.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 324px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgX3cnkBWcI/AAAAAAAAAIU/0VxW5bnRdg4/s400/Part9_3.jpg" alt="" id="BLOGGER_PHOTO_ID_5333941404718684610" border="0" /&gt;Add Javascript File&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;6. Now we can select to create a javascript file and name the Javascript fiel as DemoJavascript.js, as following.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SgX33j6TxDI/AAAAAAAAAIc/7zOUmH8LR6o/s1600-h/Part9_4.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 265px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SgX33j6TxDI/AAAAAAAAAIc/7zOUmH8LR6o/s400/Part9_4.jpg" alt="" id="BLOGGER_PHOTO_ID_5333941867594892338" border="0" /&gt;Select Javascript File Name&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;7. Double click the javascript file, and type in following code in the Javascript editor:&lt;br /&gt;&lt;br /&gt;==========================================&lt;br /&gt;&lt;br /&gt;function Getrecords() {&lt;br /&gt;&lt;br /&gt; var obj =&lt;br /&gt;         new ServiceAgent.DemoWebService.DemoDB();&lt;br /&gt;&lt;br /&gt; obj = WebServiceDemo.wsProxyGetRecords(SucceededCallback_GetRecord, FailedCallback_GetRecord);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function SucceededCallback_GetRecord(obj) {&lt;br /&gt;&lt;br /&gt;   var example_div = document.createElement('div');&lt;br /&gt;   example_div.style.cssText =&lt;br /&gt;                       'margin: 3px; '&lt;br /&gt;                       + 'border: 1px solid black; '&lt;br /&gt;                       + 'background:' + '#bbbbbb' + '; '&lt;br /&gt;                       + 'color:' + '#000000'&lt;br /&gt;               ;&lt;br /&gt;&lt;br /&gt;   document.getElementById("form1").appendChild(example_div);&lt;br /&gt;&lt;br /&gt;   var currentTime = new Date();&lt;br /&gt;   var month = currentTime.getMonth() + 1;&lt;br /&gt;   var day = currentTime.getDate();&lt;br /&gt;   var year = currentTime.getFullYear();&lt;br /&gt;   var hour = currentTime.getHours();&lt;br /&gt;   var min = currentTime.getMinutes();&lt;br /&gt;   var sec = currentTime.getSeconds();  &lt;br /&gt;  &lt;br /&gt;   example_div.appendChild(document.createTextNode(obj.arrDiscount.length&lt;br /&gt;               + " records have been retrieved at "&lt;br /&gt;               + month + "/" + day + "/" + year&lt;br /&gt;               + "  "+hour&lt;br /&gt;               +" : "+min&lt;br /&gt;               + " : " + sec));&lt;br /&gt;              &lt;br /&gt;       for (var i = 0; i &lt; obj.arrDiscount.length; i++)          {             try              {                     var record_div = document.createElement('div');                     record_div.style.cssText =                                         'margin-left: 30px; '                                         + 'margin-top: 5px; '                                         + 'border: 1px solid black; '                                         + 'background:' + '#bbbbbb' + '; '                                         + 'color:' + '#006600'                                 ;                     example_div.appendChild(record_div);                     record_div.appendChild(document.createTextNode(i+"  discount " + obj.arrDiscount[i].sDiscountType));             }             catch (e)              {             }         }  }   function FailedCallback_GetRecord() {  alert("GetRecords failed") }  ==========================================  The above javascript will call the proxy service and add a new div based on return data.  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8. Save the Javascript file.   &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;9. In the solution window, double click the Default.aspx, and change the form code to add a script manager and a link to activate the script function&lt;br /&gt;&lt;br /&gt;10. Now start the application and we should have the following web page. &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgeUhmyC-8I/AAAAAAAAAIs/bsEOP9R0Yp8/s1600-h/Part9_5.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 322px; height: 400px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgeUhmyC-8I/AAAAAAAAAIs/bsEOP9R0Yp8/s400/Part9_5.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5334395588710693826" /&gt;Data Retrieved with Javascript&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Everytime we click the "Get Record by Ajax", the data will be retreived by the javascript and a new table will be added to the web page without refresh the whole page.&lt;br /&gt;&lt;br /&gt;The live demo can be found from here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://vb.ndprice.com/default.aspx"&gt;http://vb.ndprice.com/default.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The source code for this demo can be found from here.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://vb.ndprice.com/Tutorial_VB_part9_Ajax and Web Service.zip"&gt;Tutorial_VB_part9_Ajax and Web Service.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-664172089092097288?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/664172089092097288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=664172089092097288' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/664172089092097288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/664172089092097288'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/9-ajax-demo.html' title='9 - Ajax Demo'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3LWYYeZTm30/SgXdLcZ9KEI/AAAAAAAAAIE/JpvxgjzneC8/s72-c/Part9_1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-8377235707985919114</id><published>2009-05-08T16:26:00.001-07:00</published><updated>2009-05-08T16:58:53.875-07:00</updated><title type='text'>Online tool to generate HTML/CSS code and images for rounded corners</title><content type='html'>This website provides online generation of rounded background box to decorate your web site.&lt;br&gt;&lt;br&gt;&lt;a href="http://www.roundedcornr.com/"&gt;http://www.roundedcornr.com/&lt;/a&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;Combined with the color picker from &lt;a href="http://www.colorpicker.com/"&gt;http://www.colorpicker.com/&lt;/a&gt;, it becomes much more easy to make nice box.&lt;br /&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-8377235707985919114?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/8377235707985919114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=8377235707985919114' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/8377235707985919114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/8377235707985919114'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/online-tool-to-generate-htmlcss-code.html' title='Online tool to generate HTML/CSS code and images for rounded corners'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-7289221307403596033</id><published>2009-05-08T13:34:00.000-07:00</published><updated>2009-05-08T17:05:44.270-07:00</updated><title type='text'>8 - Add Database Access to DAL</title><content type='html'>In the last a few articles we created a service oriented web site using 4 layer architecture. This article will try to connect to database in the Data Access Layer.&lt;br /&gt;&lt;br /&gt;1. Open the DemoDB project and add a class by right clicking the project name in solution window and select menu item Add -&gt; Class&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgSY3J-X5gI/AAAAAAAAAHg/adYw2jJWK5A/s1600-h/Part8_1.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 361px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgSY3J-X5gI/AAAAAAAAAHg/adYw2jJWK5A/s400/Part8_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333555932051269122" /&gt;Add DB Connection Class&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. Rename the class name to DemoDB and type following code in the class. Note: Please make sure you have the SQL Server database named as pubs ready. Otherwise, please make change accordingly.&lt;br /&gt;&lt;br /&gt;===================================&lt;br /&gt;&lt;br /&gt;Imports System.Data.SqlClient&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Public Class DemoDB&lt;br /&gt;&lt;br /&gt;    Public sDiscountType As String&lt;br /&gt;    Public sStoreID As String&lt;br /&gt;&lt;br /&gt;    Public arrDiscount As New List(Of DemoDB)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Public Function GetRecords() As DemoDB&lt;br /&gt;&lt;br /&gt;        Dim dbConnection As SqlConnection&lt;br /&gt;        Dim sqlCommand As SqlCommand&lt;br /&gt;        Dim dr As SqlDataReader&lt;br /&gt;&lt;br /&gt;        dbConnection = New SqlConnection("server=localhost;Trusted_Connection=true;database=pubs")&lt;br /&gt;        Try&lt;br /&gt;            dbConnection.Open()&lt;br /&gt;            sqlCommand = New SqlCommand("Select * from discounts", dbConnection)&lt;br /&gt;            dr = sqlCommand.ExecuteReader()&lt;br /&gt;            Dim i As Integer&lt;br /&gt;            i = 0&lt;br /&gt;            While dr.Read()&lt;br /&gt;                i = i + 1&lt;br /&gt;                Dim newRec As New DemoDB()&lt;br /&gt;                arrDiscount.Add(newRec)&lt;br /&gt;                newRec.sDiscountType = dr(0).ToString()&lt;br /&gt;                newRec.sStoreID = dr(1).ToString()&lt;br /&gt;            End While&lt;br /&gt;            dr.Close()&lt;br /&gt;            dbConnection.Close()&lt;br /&gt;        Catch e As Exception&lt;br /&gt;        End Try&lt;br /&gt;&lt;br /&gt;        Return Me&lt;br /&gt;&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;===================================&lt;br /&gt;&lt;br /&gt;3. Rebuild the class library&lt;br /&gt;&lt;br /&gt;4. Open the Web Service project, right click the DemoDAL.Dll and click the Update Reference menu button to update the DLL reference as following&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgSaPnylYbI/AAAAAAAAAHo/CjnJZBdZ1BQ/s1600-h/Part8_2.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 346px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgSaPnylYbI/AAAAAAAAAHo/CjnJZBdZ1BQ/s400/Part8_2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333557451883372978" /&gt;Update DemoDLA Reference&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;5. In the Service.vb code, add a new function to the web method list. The code will be:&lt;br /&gt;&lt;br /&gt;=====================================&lt;br /&gt;Imports System.Web&lt;br /&gt;Imports System.Web.Services&lt;br /&gt;Imports System.Web.Services.Protocols&lt;br /&gt;Imports DemoDAL.DemoDAL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.&lt;br /&gt;' &lt;System.Web.Script.Services.ScriptService()&gt; _&lt;br /&gt;&lt;WebService(Namespace:="http://DemoService.org/")&gt; _&lt;br /&gt;&lt;WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&gt; _&lt;br /&gt;&lt;Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()&gt; _&lt;br /&gt;Public Class Service&lt;br /&gt;    Inherits System.Web.Services.WebService&lt;br /&gt;&lt;br /&gt;    &lt;WebMethod()&gt; _&lt;br /&gt;    Public Function HelloWorld() As String&lt;br /&gt;        Return "Hello World"&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;    &lt;WebMethod()&gt; _&lt;br /&gt;    Public Function SayHelloFromDAL() As String&lt;br /&gt;        Dim obj As New DemoDAL.DemoDAL()&lt;br /&gt;        Return obj.SayHello()&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;    &lt;WebMethod()&gt; _&lt;br /&gt;    Public Function GetRecords() As DemoDAL.DemoDB&lt;br /&gt;        Dim obj As New DemoDAL.DemoDB&lt;br /&gt;        Return obj.GetRecords()&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;===================================== &lt;br /&gt;&lt;br /&gt;6. Rebuild the web service project and start the web service for following steps.&lt;br /&gt;&lt;br /&gt;7. Open the ServiceAgent Class Library project, update the web service reference as following&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SgSbcU_xX4I/AAAAAAAAAHw/T6HPH83e4ZE/s1600-h/Part8_3.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 369px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SgSbcU_xX4I/AAAAAAAAAHw/T6HPH83e4ZE/s400/Part8_3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333558769688338306" /&gt;Update Web Service Reference&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8. In the ServiceAgent.vb, modify the code to include a new function as following&lt;br /&gt;&lt;br /&gt;=================================&lt;br /&gt;Imports ServiceAgent.DemoWebService&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Public Class ServiceAgent&lt;br /&gt;&lt;br /&gt;    Public Function HelloFromServiceAgent()&lt;br /&gt;        Dim obj As DemoWebService.ServiceSoapClient&lt;br /&gt;        obj = New DemoWebService.ServiceSoapClient()&lt;br /&gt;        Return obj.SayHelloFromDAL()&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;    Public Function GetRecords() As DemoWebService.DemoDB&lt;br /&gt;        Dim obj As DemoWebService.ServiceSoapClient&lt;br /&gt;        obj = New DemoWebService.ServiceSoapClient()&lt;br /&gt;        Return obj.GetRecords()&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;=================================&lt;br /&gt;&lt;br /&gt;9. Rebuild the Service Agent class library.&lt;br /&gt;&lt;br /&gt;10. Open the DemoSite project, update the dll reference and add a web reference to the project as well.&lt;br /&gt;&lt;br /&gt;11. In the page load method, add some code to call the web service from both the Service Agent and web service reference directly. The code will be as following:&lt;br /&gt;&lt;br /&gt;=================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Imports ServiceAgent&lt;br /&gt;&lt;br /&gt;Partial Class _Default&lt;br /&gt;    Inherits System.Web.UI.Page&lt;br /&gt;&lt;br /&gt;    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        Dim obj As ServiceAgent.DemoWebService.ServiceSoapClient&lt;br /&gt;        obj = New ServiceAgent.DemoWebService.ServiceSoapClient()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        Dim pageHtml As String&lt;br /&gt;        pageHtml = obj.SayHelloFromDAL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        pageHtml = pageHtml &amp; "&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;"&lt;br /&gt;&lt;br /&gt;        Dim directService As DemoWebService.Service&lt;br /&gt;        directService = New DemoWebService.Service&lt;br /&gt;        Dim i As Integer&lt;br /&gt;&lt;br /&gt;        Dim recordsDirect As DemoWebService.DemoDB&lt;br /&gt;        recordsDirect = directService.GetRecords()&lt;br /&gt;        pageHtml = pageHtml &amp; "Total Records Returned by direct web service reference: " &amp; recordsDirect.arrDiscount.Length.ToString&lt;br /&gt;        i = 0&lt;br /&gt;        For Each record As DemoWebService.DemoDB In recordsDirect.arrDiscount&lt;br /&gt;            i = i + 1&lt;br /&gt;            pageHtml = pageHtml &amp; "&lt;br/&gt;" &amp; i.ToString&lt;br /&gt;            pageHtml = pageHtml &amp; "   Discount Type: " &amp; record.sDiscountType &amp; "&lt;br/&gt;"&lt;br /&gt;        Next&lt;br /&gt;        pageHtml = pageHtml &amp; "&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        Dim records As ServiceAgent.DemoWebService.DemoDB&lt;br /&gt;        records = obj.GetRecords()&lt;br /&gt;        pageHtml = pageHtml &amp; "Total Records Returned by service agaent: " &amp; records.arrDiscount.Length.ToString&lt;br /&gt;        i = 0&lt;br /&gt;        For Each record As ServiceAgent.DemoWebService.DemoDB In records.arrDiscount&lt;br /&gt;            i = i + 1&lt;br /&gt;            pageHtml = pageHtml &amp; "&lt;br/&gt;" &amp; i.ToString&lt;br /&gt;            pageHtml = pageHtml &amp; "  Discount Type: " &amp; record.sDiscountType &amp; "&lt;br/&gt;"&lt;br /&gt;        Next&lt;br /&gt;&lt;br /&gt;        pageHtml = pageHtml &amp; "&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;"&lt;br /&gt;&lt;br /&gt;        pageHtml = pageHtml &amp; "&lt;a href  ='http://www.jdoqocy.com/click-3315241-10386906' &gt;Hosted on GoDaddy&lt;/a&gt;"&lt;br /&gt;&lt;br /&gt;        Page.Form.InnerHtml = pageHtml&lt;br /&gt;        Page.Header.Title = DateTime.Now.ToString + ": Demo Web Site"&lt;br /&gt;&lt;br /&gt;    End Sub&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;=================================&lt;br /&gt;&lt;br /&gt;12. Now press F5 key to run the project, you will have the data displayed on the web pages as following&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgSeC5eYjuI/AAAAAAAAAH4/4pEiUHs4OC0/s1600-h/Part8_4.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 340px; height: 400px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgSeC5eYjuI/AAAAAAAAAH4/4pEiUHs4OC0/s400/Part8_4.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333561631338696418" /&gt;Database Access Added to Web Page&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So far we have a web page with real database support working. Next article will talk about the way to visit the web service through Javascript, in a Ajax way.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The code of this article can be downloaded here &lt;a href="http://users.ndprice.com/Tutorial_VB_part8_DatabaseAccess.zip"&gt;http://users.ndprice.com/Tutorial_VB_part8_DatabaseAccess.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-7289221307403596033?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/7289221307403596033/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=7289221307403596033' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7289221307403596033'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7289221307403596033'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/8-add-database-access-to-dal.html' title='8 - Add Database Access to DAL'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3LWYYeZTm30/SgSY3J-X5gI/AAAAAAAAAHg/adYw2jJWK5A/s72-c/Part8_1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-7751898718489666849</id><published>2009-05-08T10:40:00.001-07:00</published><updated>2009-05-08T11:36:07.402-07:00</updated><title type='text'>7 - Make the Website Online</title><content type='html'>In previous article we have implemented our first service oriented website. In this article we are going to adjust the web site configuration file, compile it and upload it to the &lt;a href="http://www.jdoqocy.com/click-3315241-10386906"&gt;GoDaddy&lt;/a&gt; hosting service&lt;br /&gt;&lt;br /&gt;1. Double click the Web.Config file, find the endpint address, and change it to: http://uservice.ndprice.com/service.asmx. This is the web service we uploaded during our web service generation.&lt;br /&gt;&lt;br /&gt;2. Under &lt;Configuration&gt; node of Web.config file, remove section ConfigSections, System.Codedom, System.WebServer. We only need to save System.Web and System.ServiceModel nodes. Under System.Web section, remove the Compilation, Controls, Assemblies, httpHandlers, httpModules sections.&lt;br /&gt;&lt;br /&gt;3. Select Main Menu -&gt; Tools -&gt; Precompile tool that we have created in Web Service section. System will compile the web site and create a deployment package as following.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgR0Rh_xkyI/AAAAAAAAAHQ/g02uI2iyNYc/s1600-h/Part7_1.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 353px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgR0Rh_xkyI/AAAAAAAAAHQ/g02uI2iyNYc/s400/Part7_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333515703245968162" /&gt;Create Web Site Deployment package&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4. Upload the web site deployment package to web hosting system on &lt;a href="http://www.jdoqocy.com/click-3315241-10386906"&gt;GoDaddy&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now type the following address in your browser, &lt;a href="http://users.ndprice.com/"&gt;http://users.ndprice.com/&lt;/a&gt;, you will see the web site is online now.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgR3ftFuSMI/AAAAAAAAAHY/ikTqoKZifkE/s1600-h/Part7_2.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 302px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgR3ftFuSMI/AAAAAAAAAHY/ikTqoKZifkE/s400/Part7_2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333519245276760258" /&gt;Service Oriented Web site Online&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The source code of all project can be downloaded from following address.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://users.ndprice.com/Tutorial_VB _Service Oriented Web Site Using VSExpress.zip"&gt;Download Tutorial_VB _Service Oriented Web Site Using VSExpress.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-7751898718489666849?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/7751898718489666849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=7751898718489666849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7751898718489666849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7751898718489666849'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/7-make-website-online.html' title='7 - Make the Website Online'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3LWYYeZTm30/SgR0Rh_xkyI/AAAAAAAAAHQ/g02uI2iyNYc/s72-c/Part7_1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-8227520748415147391</id><published>2009-05-08T07:58:00.001-07:00</published><updated>2009-05-08T11:30:20.728-07:00</updated><title type='text'>6 - First Web Site using Web Service</title><content type='html'>In previous article we have prepared a class library to work with web service. This article will try to create our real web site, and make it online. &lt;br /&gt;&lt;br /&gt;1. Start Visual Web Developer 2008 Express Edition, select Main Menu -&gt; File -&gt; New Web Site, select the ASP.NET Web Site, choose a folder to save the project and click OK.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgRJ1J3vpLI/AAAAAAAAAGY/Rr4HDSI_cuU/s1600-h/Part6_1.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 261px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgRJ1J3vpLI/AAAAAAAAAGY/Rr4HDSI_cuU/s400/Part6_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333469036245132466" /&gt;Create ASP.NET Web Site&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. Now we need to add reference to the project to make use of our Service Agent class library. Right click the project in the solution window, choose the Add Reference menu button.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgRMCKO3uEI/AAAAAAAAAGg/Ec25s2Y7T9s/s1600-h/Part6_2.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 292px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgRMCKO3uEI/AAAAAAAAAGg/Ec25s2Y7T9s/s400/Part6_2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333471458703685698" /&gt;Add Reference&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;3. Browse to the ServiceAgent.dll we created in previous article and click OK.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgRNjltxXxI/AAAAAAAAAGo/rSd4qR16U2w/s1600-h/Part6_3.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 328px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgRNjltxXxI/AAAAAAAAAGo/rSd4qR16U2w/s400/Part6_3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333473132528361234" /&gt;Reference to Web Service Agent&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4. Double click the Default.aspx.vb, and the code behind the default web page will appear in the code editor. Select the Page Event in the Class Name Drop down list.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_3LWYYeZTm30/SgROcblQ9rI/AAAAAAAAAGw/7yn5i3YLg6o/s1600-h/Part6_4.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 291px;" src="http://4.bp.blogspot.com/_3LWYYeZTm30/SgROcblQ9rI/AAAAAAAAAGw/7yn5i3YLg6o/s400/Part6_4.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333474109060871858" /&gt;Select Page Event to begin to Code&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;5. Select the Load event in the Method Name drop down list.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_3LWYYeZTm30/SgRO2UOApfI/AAAAAAAAAG4/wro15mcffuA/s1600-h/Part6_5.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 291px;" src="http://4.bp.blogspot.com/_3LWYYeZTm30/SgRO2UOApfI/AAAAAAAAAG4/wro15mcffuA/s400/Part6_5.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333474553760884210" /&gt;Add Page Load event Handler&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;6. Now type the following code in the code editor.&lt;br /&gt;&lt;br /&gt;================================================&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Imports ServiceAgent&lt;br /&gt;&lt;br /&gt;Partial Class _Default&lt;br /&gt;    Inherits System.Web.UI.Page&lt;br /&gt;&lt;br /&gt;    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        Dim obj As ServiceAgent.DemoWebService.ServiceSoapClient&lt;br /&gt;        obj = New ServiceAgent.DemoWebService.ServiceSoapClient()&lt;br /&gt;&lt;br /&gt;        Dim pageHtml As String&lt;br /&gt;        pageHtml = obj.SayHelloFromDAL&lt;br /&gt;&lt;br /&gt;        pageHtml = pageHtml &amp; "&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;"&lt;br /&gt;        pageHtml = pageHtml &amp; "&lt;a href  ='http://www.jdoqocy.com/click-3315241-10386906' &gt;Hosted on GoDaddy&lt;/a&gt;"&lt;br /&gt;&lt;br /&gt;        Page.Form.InnerHtml = pageHtml&lt;br /&gt;        Page.Header.Title = DateTime.Now.ToString + ": Demo Web Site"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    End Sub&lt;br /&gt;End Class&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;===============================================&lt;br /&gt;&lt;br /&gt;7. The last thing we need to do is to add web service endpoint address so that the web site can find the service web site. Double click the web.config file and add the following to the end of web.config file, just before the line of &lt;/configuration&gt;. &lt;br /&gt;Make sure the endpoint address is exactly the same as the web service address.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SgRri1svU6I/AAAAAAAAAHI/R5WsrETDj0M/s1600-h/Part6_7.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 332px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SgRri1svU6I/AAAAAAAAAHI/R5WsrETDj0M/s400/Part6_7.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333506104987964322" /&gt;Modify We.Config File&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The above section can be found from the app.config file of the Service Agent project.&lt;br /&gt;&lt;br /&gt;OK. Press F5 key and the web site will be displayed in the default browser as following.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SgRn1JLaYOI/AAAAAAAAAHA/IuaQVQD3Vec/s1600-h/Part6_6.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 337px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SgRn1JLaYOI/AAAAAAAAAHA/IuaQVQD3Vec/s400/Part6_6.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333502021408022754" /&gt;Web Site Running&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the next article we will talk about how to adjust the web configure file and upload it to &lt;a href="http://www.jdoqocy.com/click-3315241-10386906"&gt;GoDaddy&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-8227520748415147391?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/8227520748415147391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=8227520748415147391' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/8227520748415147391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/8227520748415147391'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/6-first-web-site-using-web-service.html' title='6 - First Web Site using Web Service'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3LWYYeZTm30/SgRJ1J3vpLI/AAAAAAAAAGY/Rr4HDSI_cuU/s72-c/Part6_1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-4810823035941667294</id><published>2009-05-08T07:26:00.001-07:00</published><updated>2009-05-08T07:56:35.011-07:00</updated><title type='text'>5 - Service Agent Layer</title><content type='html'>In previous article we created a web service and uploaded to GoDaddy. In this part we will create a Service Agent Layer to provide a universal calling functions to work with the web service.&lt;br /&gt;&lt;br /&gt;1. Similar to the steps in part 3, we will need to start VB 2008 Express edition, create a class library named as Service Agent, change the default class name to Service Agent.&lt;br /&gt;&lt;br /&gt;2. Start the Web service project so that web service is available to other projects. &lt;br /&gt;&lt;br /&gt;3. Now we will need to add a web service reference to the project. Right click the project in the solution window.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SgRB9DLi_TI/AAAAAAAAAGA/MMxYZgActq4/s1600-h/Part5_1.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 341px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SgRB9DLi_TI/AAAAAAAAAGA/MMxYZgActq4/s400/Part5_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333460375795072306" /&gt;&lt;br/&gt;Add Web Service Reference&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4. In the popped up dialog to add service reference, copy the address of the web service to the Address text box, and click Go. Now click the service in the Services tree view, and the open the ServiceSoap node, you will have the following configuratio. Remember to change the namespace to DemoWebService or any name that you will use later.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgRDwkXdYpI/AAAAAAAAAGI/Y0NjkxL-r9E/s1600-h/Part5_2.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 326px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgRDwkXdYpI/AAAAAAAAAGI/Y0NjkxL-r9E/s400/Part5_2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333462360388362898" /&gt;Confiure Web Service Reference&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;5. Type following code in the ServiceAgent.vn&lt;br /&gt;&lt;br /&gt;==========================================&lt;br /&gt;mports ServiceAgent.DemoWebService&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Public Class ServiceAgent&lt;br /&gt;&lt;br /&gt;    Public Function HelloFromServiceAgent()&lt;br /&gt;        Dim obj As DemoWebService.ServiceSoapClient&lt;br /&gt;        obj = New DemoWebService.ServiceSoapClient()&lt;br /&gt;        Return obj.SayHelloFromDAL()&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;===========================================&lt;br /&gt;&lt;br /&gt;6. Now right click the ServiceAgent project in the solution window to build the ServiceAgent dll. We will get the following dll in the bin\release folder.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgRG0ouV7CI/AAAAAAAAAGQ/d9xaEktjL3U/s1600-h/Part5_3.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 353px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgRG0ouV7CI/AAAAAAAAAGQ/d9xaEktjL3U/s400/Part5_3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333465728812444706" /&gt;Create Service Agent dll&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So far, we have finished the layer 3 in the architecture, the class library that provides a standard way to utilize web service. Next article will create the web site by using this dll.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-4810823035941667294?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/4810823035941667294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=4810823035941667294' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/4810823035941667294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/4810823035941667294'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/5-service-agent-layer.html' title='5 - Service Agent Layer'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3LWYYeZTm30/SgRB9DLi_TI/AAAAAAAAAGA/MMxYZgActq4/s72-c/Part5_1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-4881662094225668668</id><published>2009-05-07T20:30:00.000-07:00</published><updated>2009-05-08T06:54:44.677-07:00</updated><title type='text'>4 - Web Service Layer</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Web Service&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In last Article we created a simple data access layer class library. In this article we will create a web service to consume the class library.&lt;br /&gt;&lt;br /&gt;1. Let us start Visual Web Developer 2008 Express Edition.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SgOoGNFTKPI/AAAAAAAAAEg/oMrX3z5D2lw/s1600-h/part4_1.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 307px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SgOoGNFTKPI/AAAAAAAAAEg/oMrX3z5D2lw/s400/part4_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333291208281368818" /&gt;&lt;br/&gt;VWD 2008 Express Edition&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. Click File -&gt; New Website. From the Visual Studio Installed Packages in the popped out dialog, select ASP.NET Web Service, pick a proper folder to save the web site, and then click OK to create the project, as following&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_3LWYYeZTm30/SgOpHrG8StI/AAAAAAAAAEo/LZe0LkOoMjo/s1600-h/part4_2.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 261px;" src="http://4.bp.blogspot.com/_3LWYYeZTm30/SgOpHrG8StI/AAAAAAAAAEo/LZe0LkOoMjo/s400/part4_2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333292333032819410" /&gt;&lt;br/&gt;Create ASP .NET Web Service&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;3. Now we will have a default web service web site projectas following.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOpp6ZCQrI/AAAAAAAAAEw/ALola-Ahsjw/s1600-h/part4_3.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 307px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOpp6ZCQrI/AAAAAAAAAEw/ALola-Ahsjw/s400/part4_3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333292921250792114" /&gt;&lt;br/&gt;Default ASP.Net Web Service Project&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4. Right click the project in the solution window and click the add reference menu button to add a reference to our DemoDAL class library.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgOqYmIiUSI/AAAAAAAAAE4/uaydETjsMEQ/s1600-h/part4_4.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 305px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgOqYmIiUSI/AAAAAAAAAE4/uaydETjsMEQ/s400/part4_4.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333293723266732322" /&gt;&lt;br/&gt;Add Reference&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOq0UfcWKI/AAAAAAAAAFA/oBTryjJBCdg/s1600-h/part4_5.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 328px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOq0UfcWKI/AAAAAAAAAFA/oBTryjJBCdg/s400/part4_5.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333294199567308962" /&gt;&lt;br/&gt;Select Reference&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;6. Now we have the reference to our DemoDAL library, we can import the library in our web service and start to call the function. In the service.vb file, type following code.&lt;br /&gt;&lt;br /&gt;==============================&lt;br /&gt;&lt;span style="font-style:italic;"&gt;&lt;br /&gt;Imports System.Web&lt;br /&gt;Imports System.Web.Services&lt;br /&gt;Imports System.Web.Services.Protocols&lt;br /&gt;Imports DemoDAL.DemoDAL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.&lt;br /&gt;' &lt;System.Web.Script.Services.ScriptService()&gt; _&lt;br /&gt;&lt;WebService(Namespace:="http://DemoService.org/")&gt; _&lt;br /&gt;&lt;WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)&gt; _&lt;br /&gt;&lt;Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()&gt; _&lt;br /&gt;Public Class Service&lt;br /&gt;    Inherits System.Web.Services.WebService&lt;br /&gt;&lt;br /&gt;    &lt;WebMethod()&gt; _&lt;br /&gt;    Public Function HelloWorld() As String&lt;br /&gt;        Return "Hello World"&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;    &lt;WebMethod()&gt; _&lt;br /&gt;    Public Function SayHelloFromDAL() As String&lt;br /&gt;        Dim obj As New DemoDAL.DemoDAL()&lt;br /&gt;        Return obj.SayHello()&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;================================&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;7. We can set the Service.asmx as start up page by right clicking this file in the solution window as following&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOtNyHeYKI/AAAAAAAAAFI/669KikwbV28/s1600-h/part4_6.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 306px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOtNyHeYKI/AAAAAAAAAFI/669KikwbV28/s400/part4_6.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333296836039827618" /&gt;&lt;br/&gt;Set start page&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;8. We need to change the property of the project to use static port instead of dynamic port during debug.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SgOtf_8ILQI/AAAAAAAAAFQ/ARaRlvAmz-I/s1600-h/part4_7.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 307px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SgOtf_8ILQI/AAAAAAAAAFQ/ARaRlvAmz-I/s400/part4_7.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333297148987976962" /&gt;&lt;br/&gt;Change Start Port&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;9. Finally we can start to debug the web service by press F5 key.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_3LWYYeZTm30/SgOt9afZtsI/AAAAAAAAAFY/G82HdcYnsBE/s1600-h/part4_8.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 306px;" src="http://4.bp.blogspot.com/_3LWYYeZTm30/SgOt9afZtsI/AAAAAAAAAFY/G82HdcYnsBE/s400/part4_8.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333297654331455170" /&gt;&lt;br/&gt;See Our Web Service&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;10. By now, we have got our first web service running on our development enviroment. In order to upload the web service to a web hosting server such as such as &lt;a href="http://www.kqzyfj.com/click-3315241-10378406"&gt;GoDaddy&lt;/a&gt;, &lt;a href="http://www.dpbolvw.net/click-3315241-10392890"&gt;IXWeb Hosting&lt;/a&gt;,  &lt;a href="http://www.kqzyfj.com/click-3315241-10402391"&gt; 1&amp;1 Web Hosting&lt;/a&gt;, &lt;a href="http://www.anrdoezrs.net/click-3315241-10383586"&gt;omnis&lt;/a&gt;, &lt;a href="http://www.kqzyfj.com/click-3315241-8286436"&gt;Lunarpages&lt;/a&gt; etc, we need to compile our web service first.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOvys53oHI/AAAAAAAAAFg/Xg1D9ZYpZoA/s1600-h/part4_9.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 307px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOvys53oHI/AAAAAAAAAFg/Xg1D9ZYpZoA/s400/part4_9.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333299669319000178" /&gt;&lt;br/&gt;Add Compiling Tools&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;11. Add external tools as following:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_3LWYYeZTm30/SgOwLQGDIoI/AAAAAAAAAFo/G8wffiNxjKA/s1600-h/part4_10.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 396px; height: 391px;" src="http://2.bp.blogspot.com/_3LWYYeZTm30/SgOwLQGDIoI/AAAAAAAAAFo/G8wffiNxjKA/s400/part4_10.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333300091082187394" /&gt;&lt;br/&gt;Compile Tool Parameters&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Second line is: (please make sure you have this file in the proper folder)&lt;br /&gt;C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe&lt;br /&gt;&lt;br /&gt;Third line is:&lt;br /&gt;-p "$(ProjectDir)" -v / "$(ProjectDir)\..\CompiledApp"&lt;br /&gt;&lt;br /&gt;12. Now you can click the Main Menu -&gt; Tools -&gt;Pre Compile to generate a web service installation package.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SgOxQNk_ipI/AAAAAAAAAFw/PzgPoW0YQmw/s1600-h/part4_12.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 360px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SgOxQNk_ipI/AAAAAAAAAFw/PzgPoW0YQmw/s400/part4_12.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333301275817642642" /&gt;&lt;br/&gt;Deployment package&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;13. You can now upload the depoyment package to a web server hosting environment. I have a hosting account with &lt;a href="http://www.kqzyfj.com/click-3315241-10378406"&gt;GoDaddy&lt;/a&gt;, therefore I have uploaded the demoweb service to the following website.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOyUYt8uSI/AAAAAAAAAF4/Hp7w83SFkpQ/s1600-h/part4_13.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 273px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOyUYt8uSI/AAAAAAAAAF4/Hp7w83SFkpQ/s400/part4_13.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333302447039101218" /&gt;&lt;br/&gt;Uploading Web Service&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://uservice.ndprice.com/service.asmx"&gt;Demo Service&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-4881662094225668668?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/4881662094225668668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=4881662094225668668' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/4881662094225668668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/4881662094225668668'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/create-service-oriented-web-site-using_5088.html' title='4 - Web Service Layer'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3LWYYeZTm30/SgOoGNFTKPI/AAAAAAAAAEg/oMrX3z5D2lw/s72-c/part4_1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-7928808881507467538</id><published>2009-05-07T19:47:00.000-07:00</published><updated>2009-05-08T06:47:47.657-07:00</updated><title type='text'>3 - Data Access Layer</title><content type='html'>&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Data Access Layer&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this section we will create a VB. Net class library that will serve as the data access layer.&lt;br /&gt;&lt;br /&gt;First Let us start VB .Net 2008.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3LWYYeZTm30/SgOfR4LETnI/AAAAAAAAADw/Lmduffzbufk/s1600-h/Part3_1.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 322px;" src="http://1.bp.blogspot.com/_3LWYYeZTm30/SgOfR4LETnI/AAAAAAAAADw/Lmduffzbufk/s400/Part3_1.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333281513222196850" /&gt;&lt;br/&gt;Start VB .Net&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, we will create a VB.Net Class Library Project called SiteDAL.dll&lt;br /&gt;1. Click File -&gt; Create New. From the Visual Studio Installed Templates in the pop up dialog, choose Class Library and set the name of the class library as DemoDAL, as following:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_3LWYYeZTm30/SgOgk25T9NI/AAAAAAAAAD4/fnZDrfvb6FQ/s1600-h/Part3_2.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 281px;" src="http://4.bp.blogspot.com/_3LWYYeZTm30/SgOgk25T9NI/AAAAAAAAAD4/fnZDrfvb6FQ/s400/Part3_2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333282938808431826" /&gt;&lt;br/&gt;Create DAL project&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. Click OK to create the project. We will have a default Class Library Project as following.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOhc_4KFQI/AAAAAAAAAEA/mQ-BUdYlXD8/s1600-h/Part3_3.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 347px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOhc_4KFQI/AAAAAAAAAEA/mQ-BUdYlXD8/s400/Part3_3.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333283903292183810" /&gt;&lt;br/&gt;Default DAL project&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;3. Rename the default class name to "DemoDAL.VB" by right clicking the "Class1.vb" in the solution explorer window. The class name will also be changed to DemoDAL automatically as following:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOiWw--dwI/AAAAAAAAAEI/3k7vsVwVxio/s1600-h/Part3_4.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 347px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOiWw--dwI/AAAAAAAAAEI/3k7vsVwVxio/s400/Part3_4.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333284895726663426" /&gt;&lt;br/&gt;Change Class Name&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4. Create a simple function in the DemoDAL class by adding following code in the class.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style:italic;"&gt;Public Class DemoDAL&lt;br /&gt;&lt;br /&gt;    Public Function SayHello()&lt;br /&gt;        Return "Hello World From DAL Class Library"&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5. Click Save Button of VB. Net to save the project to folder of your choice.&lt;br /&gt;&lt;br /&gt;6. Click Build -&gt; Build DemoDAL from the main Menu, or just right click the project in the solution window and choose to build. &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_3LWYYeZTm30/SgOlKkrks_I/AAAAAAAAAEQ/MEDG1a9CdpM/s1600-h/Part3_5.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 347px;" src="http://4.bp.blogspot.com/_3LWYYeZTm30/SgOlKkrks_I/AAAAAAAAAEQ/MEDG1a9CdpM/s400/Part3_5.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333287984800510962" /&gt;&lt;br/&gt;Build the Project&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;7. Now we will get a DemoDAL.dll in the bin\release folder under the directory where we choose to save the project.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_3LWYYeZTm30/SgOluEOO_hI/AAAAAAAAAEY/WcvFW_8dCzk/s1600-h/Part3_6.jpg"&gt;&lt;img style="float:center; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 400px; height: 361px;" src="http://4.bp.blogspot.com/_3LWYYeZTm30/SgOluEOO_hI/AAAAAAAAAEY/WcvFW_8dCzk/s400/Part3_6.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333288594562809362" /&gt;&lt;br/&gt;DemoDAL dll&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So far we have successfully created a Data Access Layer even though no database operation is involved at all. We will come back to this project later to add the database manipulation functions later. For now, we are more interested in the architecture layout of the website.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-7928808881507467538?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/7928808881507467538/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=7928808881507467538' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7928808881507467538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7928808881507467538'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/create-service-oriented-web-site-using_468.html' title='3 - Data Access Layer'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3LWYYeZTm30/SgOfR4LETnI/AAAAAAAAADw/Lmduffzbufk/s72-c/Part3_1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-7378775997773372893</id><published>2009-05-07T19:41:00.000-07:00</published><updated>2009-05-08T06:48:31.063-07:00</updated><title type='text'>2 - Architecture Review</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Architecture&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This part of the article will discuss the architecture that will be used to build a scalable and efficient web site.&lt;br /&gt;&lt;br /&gt;The following is the structure of the web site we are going to implement in this series of articles.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOc4pJL4mI/AAAAAAAAADo/EJM54TA_tHY/s1600-h/Architecture.jpg"&gt;&lt;img style="float:center; margin:0 0 0px 0px;cursor:pointer; cursor:hand;width: 400px; height: 247px;" src="http://3.bp.blogspot.com/_3LWYYeZTm30/SgOc4pJL4mI/AAAAAAAAADo/EJM54TA_tHY/s400/Architecture.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5333278880667787874" /&gt;&lt;br/&gt; Architecture Diagram&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The data access layer is responsible for all functions to create object entities, communicate with database and perform business logic at server side. It will create the connection with database, call stored procedures to manipulate database and perform some data reorganization if necessary. This layer is a class library project developed using Visual Basic .Net.&lt;br /&gt;&lt;br /&gt;The second layer is an ASP .NET WEB Service project developed using Visual Web Developer 2008 Express Edition. This layer provides an universal access to the database through web service to provide a loose coupled architecture.&lt;br /&gt;&lt;br /&gt;The third layer, which is also a Visual Basic class library dll, is developed to simplify the call to the web service so that UI developers do not need to configure the web service invoke and respond to the service. &lt;br /&gt;&lt;br /&gt;Now the web service can be used in the fourth layer, or the UI layer, as standard objects or classes in the ASP.Net web pages despite the fact that all the data and computing is provided remotely by another web site.&lt;br /&gt;&lt;br /&gt;In order to provide Ajax access to the web service, service proxy is required at the fourth level so that web service object is available in the Javascript.&lt;br /&gt;&lt;br /&gt;The above architecture has a lot of benefit.&lt;br /&gt;1. Web service layer provides loose coupling of the modules so that web server load can be balanced among different web servers&lt;br /&gt;2. Web servers can also configured so that certain group of services are hosted together and other calculation intensive service can be hosted independently.&lt;br /&gt;3. Data access layer can be directly used in the UI development is web service is not required&lt;br /&gt;4. Web Service Agent dll can be used Web application and Desktop application exactly the same way. It allows the easier system maintenance as the web service handling mechanism is standardized.&lt;br /&gt;5. Service for different modules can be hosted in different service application and web servers to allow independent development in a team.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-7378775997773372893?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/7378775997773372893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=7378775997773372893' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7378775997773372893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7378775997773372893'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/create-service-oriented-web-site-using_07.html' title='2 - Architecture Review'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3LWYYeZTm30/SgOc4pJL4mI/AAAAAAAAADo/EJM54TA_tHY/s72-c/Architecture.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8072873846125946515.post-7821500481015244365</id><published>2009-05-07T15:58:00.000-07:00</published><updated>2009-05-08T06:31:45.412-07:00</updated><title type='text'>1 - Service Oriented Web Site with VS Express 2008</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Introduction&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In this series of articles, I will walk you through the steps to create Service Oriented Web Site Using  VB .Net 2008 Express Edition and Visual Web Developer 2008 Express edition. This set of articles is designed for beginners and for those who want to explore new technologies, like me.&lt;br /&gt;&lt;br /&gt;First you need to download Visual Studio Express Editions from following web site. &lt;a href="http://www.microsoft.com/express/download/"&gt;http://www.microsoft.com/express/download/&lt;/a&gt;  &lt;br /&gt;&lt;br /&gt;After installing the Express editions Visual Basic 2008 Express edition and Visual Web Developer 2008 Express edition, we can start to build out service oriented web site using these excellent tools, all for free. I have been using the profession editions and team editions of Visual studio that provides more tools and templates for a long time, I do not actually see any functions that I need for my commercial software development can not be achieved through the free tools, although you may need to spend a little longer to get the work done. The &lt;a href="http://ndprice.com/default-loid1-orid0-ctid5898-rgid37-caid88520750-49ef-450b-8a00-4a016587f6ed-pgid1.aspx"&gt;NDPrice&lt;/a&gt; website is a good sample of what we can do with Visual Studio 2008 Express editions. A lot of web hosting providers such as &lt;a href="http://www.kqzyfj.com/click-3315241-10378406"&gt;GoDaddy&lt;/a&gt;, &lt;a href="http://www.dpbolvw.net/click-3315241-10392890"&gt;IXWeb Hosting&lt;/a&gt;,  &lt;a href="http://www.kqzyfj.com/click-3315241-10402391"&gt; 1&amp;1 Web Hosting&lt;/a&gt;, &lt;a href="http://www.anrdoezrs.net/click-3315241-10383586"&gt;omnis&lt;/a&gt;, &lt;a href="http://www.kqzyfj.com/click-3315241-8286436"&gt;Lunarpages&lt;/a&gt; etc. can all successfully host the web site developed with express editions. &lt;br /&gt;&lt;br /&gt;Following web hosting service can not host the web site developed in this series of articles: &lt;a href="http://www.kqzyfj.com/click-3315241-10640712"&gt; Yahoo small business &lt;/a&gt;, &lt;a href="http://www.anrdoezrs.net/click-3315241-10422102"&gt;Hosting Monster&lt;/a&gt;, &lt;a href="http://www.tkqlhce.com/click-3315241-10382553"&gt;I Power Web&lt;/a&gt;, &lt;a href="http://www.tkqlhce.com/click-3315241-10394288"&gt;Power Web&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8072873846125946515-7821500481015244365?l=vbnetwork.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vbnetwork.blogspot.com/feeds/7821500481015244365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8072873846125946515&amp;postID=7821500481015244365' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7821500481015244365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8072873846125946515/posts/default/7821500481015244365'/><link rel='alternate' type='text/html' href='http://vbnetwork.blogspot.com/2009/05/create-service-oriented-web-site-using.html' title='1 - Service Oriented Web Site with VS Express 2008'/><author><name>David</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
