Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use the attached TLC\'s Real Estate database, OR create a Microsoft Access datab

ID: 3834143 • Letter: U

Question

Use the attached TLC's Real Estate database, OR create a Microsoft Access database that contains one table named tblHomes. The table should contain 10 records, each having six fields. The ID, City, and state fields should contain text. The number bedrooms, number of bathrooms fields should be numeric. The Price field should be currency.

Create an application that displays the contents of the database in a DataGridView control. If necessary, remove the BindingNavigator control from the application. The application should allow the user to insert and delete records. It should also allow the user to display the records for a specific number of bedrooms, a specific number of bathrooms, a specific City, and a specific combination of bedrooms and bathrooms.




This is for Visual Basic.

ID CITY STATE #BEDROOMS #BATHROOMS #PRICE 21 Pell City AL 3 2 $239,000.00 35 Talladega AL 2 1 $45,500.00 45 Oxford AL 3 2 $159,000.00 52 Anniston AL 2 1 $39,000.00 96 Muford AL 4 2 $129,300.00 123 Nashville TN 4 3 $500,950.00 417 Gadsden AL 3 2 $255,900.00 654 Atlanta AL 2 1 $170,000.00 685 Heflin AL 4 2.5 $189.000.00 8654 Oxford AL 3 2 $199,000.00

Explanation / Answer

using System.Data; using System.Data.SqlServerCe; using System.Windows.Forms; namespace WindowsFormsApplication5 { public partial class Form1 : Form { public Form1() { InitializeComponent(); FillData(); } void FillData() { // 1 // Open connection using (SqlCeConnection c = new SqlCeConnection( Properties.Settings.Default.DataConnectionString)) { c.Open(); // 2 // Create new DataAdapter using (SqlCeDataAdapter a = new SqlCeDataAdapter( "SELECT * FROM Animals", c)) { // 3 // Use DataAdapter to fill DataTable DataTable t = new DataTable(); a.Fill(t); // 4 // Render data onto the screen dataGridView1.DataSource = t; } } } } }