{"id":53206,"date":"2024-04-26T23:33:40","date_gmt":"2024-04-26T23:33:40","guid":{"rendered":"http:\/\/localhost\/branding\/acscars-inc-connected-and-disconnected-environment\/"},"modified":"2024-04-26T23:33:40","modified_gmt":"2024-04-26T23:33:40","slug":"acscars-inc-connected-and-disconnected-environment","status":"publish","type":"post","link":"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/","title":{"rendered":"ACSCars, Inc. Connected and Disconnected Environment"},"content":{"rendered":"<p>ACSCars, Inc.: Connected and Disconnected Environment<\/p>\n<p>Refer to the ACSCars database from previous weeks and complete the following tasks and discussion.<\/p>\n<p>\u2022Using the connection created in the previous assignment,  Discussion and the Data command, populate a DataGrid that connects to the Tcars table and shows all fields for the cars, including prices.<\/p>\n<p>This is populated using addItem() method<\/p>\n<p>import fl.controls.DataGrid; <\/p>\n<p>var myDataGrid:DataGrid = new DataGrid(); <\/p>\n<p>myDataGrid.addColumn(&#8220;Tcars&#8221;); <\/p>\n<p>myDataGrid.addColumn(&#8220;Tvendors&#8221;); <\/p>\n<p>myDataGrid.addColumn(&#8220;Tdealers&#8221;); <\/p>\n<p>myDataGrid.addColumn(&#8220;Transaction_master&#8221;); <\/p>\n<p>myDataGrid.addItem({Tcars:&#8221;Car_id&#8221;, Tdealers:&#8221;dealer_id&#8221;, Tvendors:&#8221;vendor_id&#8221;, Transaction_master:&#8221;trans_id&#8221;}); <\/p>\n<p>myDataGrid.addItem({Tcars:&#8221;car_name&#8221;, Tdealers:&#8221;dealer_name&#8221;, Tvendors:&#8221;vendor_name&#8221;, Transaction_master:&#8221;dealer_id&#8221;}); <\/p>\n<p>myDataGrid.addItem({Tcars:&#8221;car_type&#8221;, Tdealers:&#8221;dealer_location&#8221;, Tvendors:&#8221;vendor_location&#8221;, Transaction_master:&#8221;car_id&#8221;}); <\/p>\n<p>myDataGrid.addItem({Tcars:&#8221;car_model&#8221;, Tdealers:&#8221;dealer_state&#8221;, Tvendors:&#8221;vendor_state&#8221;, Transaction_master:&#8221;car_amnt&#8221;}); <\/p>\n<p>myDataGrid.addItem({Tcars:&#8221;car_color&#8221;, Tdealers:&#8221;dealer_phno&#8221;, Tvendors:&#8221;vendor_phno&#8221;, Transaction_master:&#8221;car_discount&#8221;}); <\/p>\n<p>myDataGrid.addItem({Tcars:&#8221;car_price&#8221;, Tdealers:&#8221;&#8221;, Tvendors:&#8221;vendor_items&#8221;, Transaction_master:&#8221;car_date&#8221;}); <\/p>\n<p>myDataGrid.width = 200; myDataGrid.move(10, 10); <\/p>\n<p>addChild(myDataGrid);<\/p>\n<p>Screen shot<\/p>\n<p>\u2022Bind the DataGrid to the DataReader in a connected environment.<\/p>\n<p>SqlCommand cm = new SqlCommand(&#8220;Select * from ACSCars&#8221;, con);<\/p>\n<p> SqlDataReader dr;<\/p>\n<p> dr = cm.ExecuteReader();<\/p>\n<p> DataTable dataTable = new DataTable();<\/p>\n<p> dataTable.Load(dr);<\/p>\n<p>\u2022Answer the following questions with respect to a disconnected environment:<\/p>\n<p>string ACSCarsConnectionString =<\/p>\n<p>    &#8220;Server=localhost;Database= ACSCars;&#8221; +<\/p>\n<p>    &#8220;Trusted_Connection=True;<\/p>\n<p>MultipleActiveResultSets=True&#8221;;<\/p>\n<p>\u25e6How will the two DataAdapter objects be created? <\/p>\n<p>The first step was creating a new Sqlconnection instance. This entailed including the System.Data.SqlClient namespace in the program. <\/p>\n<p>After calling Open () on the sqlconnection created, we use another block for the sqldataAdapters <\/p>\n<p>The third step entailed filling dataTable. The fill method was essential in populating the internal rows and columns on Datatable to match the SQL result<\/p>\n<p>\u25e6How will you retrieve data from these two DataAdapters? <\/p>\n<p>Data is retrieved through \u201cfill\u201d. Fill is among the essential methods of retrieving data on the DataAdapter objects. Fill executes the query and fills the DatabAdapter objects with the results retrieved from the database. <\/p>\n<p>\u25e6What is the syntax for filling DataSet by using the Fill method?<\/p>\n<p>The fill method allows users obtain the value of a column from the DataRow object and handles the casting DBNull. Basically, the fill method has six different prototypes. <\/p>\n<p>When using the syntax, the table name that one passes is actually the source table name, so the actual table name as used in the Dataset may be different if table mapping is in use. <\/p>\n<p>\u2022In addition, define the steps involved in creating a database application by using DataAdapter Configuration Wizard.<\/p>\n<p>The first step involves creating Windows Application template. <\/p>\n<p>Step 2: Adding a Data Grid Control to the Form this stag einvolves adding Datagrid control to the form by dragging it from the Toolbox &gt; Window forms category. Step 3: Adding a Data Adapter Componentthis is done by dragging sqlDataAdapter control from the Toolbox to the open form. When one drags the data adapter (Sql, OleDb, or ODBC), the DataAdapter configuration wizards open up.  <\/p>\n<p>The second page allows one crate a new connection or picking from the connection list. Note visual studio has default Puran SQL server. <\/p>\n<p>Choosing a query type<\/p>\n<p>This page is for selling command types. A command set entails SQL statement <\/p>\n<p>Generate the SQL Statementthis page allows one build SQL statement.<\/p>\n<p>Query Builder<\/p>\n<p>This stage involves picking tables from the data source. This start by selecting ASCcars table to tead in the data. There are options of selecting as many tables as one may need. <\/p>\n<p>Now, I&#8217;ll select three columns from the database table. <\/p>\n<p>Step4: Setting and Reviewing Data Adapter properties once DataAdapter is on the form, one need to check the sqlDataAdapter component properties. This can be seen by right clicking on the adapter and selecting properties menu item. <\/p>\n<p>Figure: Setting the SQL select command in the data adapter<\/p>\n<p>Step 5: Filling the Data Grid Control with Datathis entails creating fillDbGrid, which fills a Dataset object. This is followed by reading data from a DataSet object and populating the DataGrid control. <\/p>\n<p>Listing: FillDB Grid Methodprotected void FillDBGrid()\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 DataSet ds = new DataSet();\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 sqlDataAdapter1.Fill(ds);\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 dataGrid1.DataSource = ds.DefaultViewManager;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }Listing: Calling the Fill DB Grid from the Form1 constructorpublic Form1()\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 InitializeComponent();\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 FillDBGrid(); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ACSCars, Inc.: Connected and Disconnected Environment Refer to the ACSCars database from previous weeks and complete the following tasks and<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-53206","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>ACSCars, Inc. Connected and Disconnected Environment - sheilathewriter<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ACSCars, Inc. Connected and Disconnected Environment - sheilathewriter\" \/>\n<meta property=\"og:description\" content=\"ACSCars, Inc.: Connected and Disconnected Environment Refer to the ACSCars database from previous weeks and complete the following tasks and\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/\" \/>\n<meta property=\"og:site_name\" content=\"sheilathewriter\" \/>\n<meta property=\"article:published_time\" content=\"2024-04-26T23:33:40+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/\",\"url\":\"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/\",\"name\":\"ACSCars, Inc. Connected and Disconnected Environment - sheilathewriter\",\"isPartOf\":{\"@id\":\"https:\/\/sheilathewriter.com\/blog\/#website\"},\"datePublished\":\"2024-04-26T23:33:40+00:00\",\"author\":{\"@id\":\"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/f5844d28db4a1882523a0a69560bf0ab\"},\"breadcrumb\":{\"@id\":\"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/sheilathewriter.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ACSCars, Inc. Connected and Disconnected Environment\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/sheilathewriter.com\/blog\/#website\",\"url\":\"https:\/\/sheilathewriter.com\/blog\/\",\"name\":\"sheilathewriter\",\"description\":\"Custom essay writing\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/sheilathewriter.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/f5844d28db4a1882523a0a69560bf0ab\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9cf817440d627e98709fcac9c5cc379958985e679d683af80df1879b5a471013?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9cf817440d627e98709fcac9c5cc379958985e679d683af80df1879b5a471013?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/opskill.com\/propapers\"],\"url\":\"https:\/\/sheilathewriter.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ACSCars, Inc. Connected and Disconnected Environment - sheilathewriter","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/","og_locale":"en_US","og_type":"article","og_title":"ACSCars, Inc. Connected and Disconnected Environment - sheilathewriter","og_description":"ACSCars, Inc.: Connected and Disconnected Environment Refer to the ACSCars database from previous weeks and complete the following tasks and","og_url":"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/","og_site_name":"sheilathewriter","article_published_time":"2024-04-26T23:33:40+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/","url":"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/","name":"ACSCars, Inc. Connected and Disconnected Environment - sheilathewriter","isPartOf":{"@id":"https:\/\/sheilathewriter.com\/blog\/#website"},"datePublished":"2024-04-26T23:33:40+00:00","author":{"@id":"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/f5844d28db4a1882523a0a69560bf0ab"},"breadcrumb":{"@id":"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/sheilathewriter.com\/blog\/acscars-inc-connected-and-disconnected-environment\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sheilathewriter.com\/blog\/"},{"@type":"ListItem","position":2,"name":"ACSCars, Inc. Connected and Disconnected Environment"}]},{"@type":"WebSite","@id":"https:\/\/sheilathewriter.com\/blog\/#website","url":"https:\/\/sheilathewriter.com\/blog\/","name":"sheilathewriter","description":"Custom essay writing","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sheilathewriter.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/f5844d28db4a1882523a0a69560bf0ab","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sheilathewriter.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9cf817440d627e98709fcac9c5cc379958985e679d683af80df1879b5a471013?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9cf817440d627e98709fcac9c5cc379958985e679d683af80df1879b5a471013?s=96&d=mm&r=g","caption":"admin"},"sameAs":["http:\/\/opskill.com\/propapers"],"url":"https:\/\/sheilathewriter.com\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/posts\/53206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/comments?post=53206"}],"version-history":[{"count":0,"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/posts\/53206\/revisions"}],"wp:attachment":[{"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/media?parent=53206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/categories?post=53206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sheilathewriter.com\/blog\/wp-json\/wp\/v2\/tags?post=53206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}