ACSCars, Inc.: Connected and Disconnected Environment

Essay > Words: 836 > Rating: Excellent > Buy full access at $1

ACSCars, Inc.: Connected and Disconnected Environment

Refer to the ACSCars database from previous weeks and complete the following tasks and discussion.

  • Using 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.

This is populated using addItem() method

importfl.controls.DataGrid;

varmyDataGrid:DataGrid = new DataGrid();

myDataGrid.addColumn(“Tcars”);

myDataGrid.addColumn(“Tvendors”);

myDataGrid.addColumn(“Tdealers”);

myDataGrid.addColumn(“Transaction_master”);

myDataGrid.addItem({Tcars:”Car_id”, Tdealers:”dealer_id”, Tvendors:”vendor_id”, Transaction_master:”trans_id”});

myDataGrid.addItem({Tcars:”car_name”, Tdealers:”dealer_name”, Tvendors:”vendor_name”, Transaction_master:”dealer_id”});

myDataGrid.addItem({Tcars:”car_type”, Tdealers:”dealer_location”, Tvendors:”vendor_location”, Transaction_master:”car_id”});

myDataGrid.addItem({Tcars:”car_model”, Tdealers:”dealer_state”, Tvendors:”vendor_state”, Transaction_master:”car_amnt”});

myDataGrid.addItem({Tcars:”car_color”, Tdealers:”dealer_phno”, Tvendors:”vendor_phno”, Transaction_master:”car_discount”});

myDataGrid.addItem({Tcars:”car_price”, Tdealers:””, Tvendors:”vendor_items”, Transaction_master:”car_date”});

myDataGrid.width = 200; myDataGrid.move(10, 10);

addChild(myDataGrid);

Screen shot

  • Bind the DataGrid to the DataReader in a connected environment.

SqlCommand cm = new SqlCommand(“Select * from ACSCars”, con);SqlDataReaderdr;dr = cm.ExecuteReader();DataTabledataTable = new DataTable();dataTable.Load(dr);

  • Answer the following questions with respect to a disconnected environment:

stringACSCarsConnectionString =    “Server=localhost;Database= ACSCars;” +    “Trusted_Connection=True;MultipleActiveResultSets=True”;

◦How will the two DataAdapter objects be created?

The first step was creating a new Sqlconnection instance. This entailed including the System.Data.SqlClient namespace in the program.

After calling Open () on the sqlconnection created, we use another block for the sqldataAdapters

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

◦How will you retrieve data from these two DataAdapters?

D.............


Type: Essay || Words: 836 Rating || Excellent

Subscribe at $1 to view the full document.

Buy access at $1
CategoriesUncategorized