using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace AltairRealtors6
{
public partial class AltairRealtors : Form
{
public AltairRealtors()
{
InitializeComponent();
}
private void AltairRealtors_Load(object sender, EventArgs e)
{
using (SqlConnection cnnAltairRealtors1 =
new SqlConnection("Data Source=(local);" +
"Integrated Security='SSPI';"))
{
string strDatabase = "IF EXISTS (" +
"SELECT * " +
" FROM sys.databases " +
" WHERE name = N'AltairRealtors1' " +
")" +
"DROP DATABASE AltairRealtors1;" +
"CREATE DATABASE AltairRealtors1;";
SqlCommand cmdAltairRealtors1 = new SqlCommand(strDatabase,
cnnAltairRealtors1);
cnnAltairRealtors1.Open();
cmdAltairRealtors1.ExecuteNonQuery();
MessageBox.Show("The AltairRealtors1 database has been created");
}
using (SqlConnection cnnAltairRealtors1 =
new SqlConnection("Data Source=(local);" +
"Database='AltairRealtors1';" +
"Integrated Security='SSPI';"))
{
string strAltairRealtors1 =
"CREATE TABLE Properties" +
"(" +
"PropertyID int identity(1,1) NOT NULL," +
"PropertyNumber char(6)," +
"Address varchar(100)," +
"City varchar(50)," +
"State char(2)," +
"ZIPCode varchar(12)," +
"PropertyType varchar(40)," +
"Condition varchar(32)," +
"Bedrooms smallint," +
"Bathrooms float," +
"FinishedBasement bit," +
"IndoorGarage bit," +
"Stories smallint," +
"YearBuilt smallint," +
"MarketValue money" +
");";
SqlCommand cmdAltairRealtors1 =
new SqlCommand(strAltairRealtors1,
cnnAltairRealtors1);
cnnAltairRealtors1.Open();
cmdAltairRealtors1.ExecuteNonQuery();
MessageBox.Show("The Properties table has been created");
}
using (SqlConnection cnnAltairRealtors1 =
new SqlConnection("Data Source=(local);" +
"Database='AltairRealtors1';" +
"Integrated Security='SSPI';"))
{
string strAltairRealtors1 =
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('524880', '1640 Lombardo Ave', 'Silver Spring', 'MD'," +
"'20904', 'Single Family', 'Good', 4, 2.5, 3, 1, 3, 1995, 495880.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('688364', '10315 North Hacht Rd', 'College Park', 'MD'," +
"'20747', 'Single Family', 'Excellent', 4, 3.5, 3," +
"1, 2, 2000, 620724.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, FinishedBasement," +
"Stories, MarketValue)" +
"VALUES('611464', '6366 Lolita Drive', 'Laurel', 'MD'," +
"'20707', 'Single Family', 'Good', 1, 2, 422625.00);" +
"INSERT INTO Properties(Address, City, PropertyType," +
"Bedrooms, MarketValue)" +
"VALUES('9002 Palasko Hwy', 'Tysons Corner'," +
"'Condominium', 2, 422895.00);" +
"INSERT INTO Properties(PropertyNumber, State," +
"ZIPCode, Bedrooms, YearBuilt, MarketValue)" +
"VALUES('420115', 'DC'," +
"'20011', 2, 1982, 312555);" +
"INSERT INTO Properties(PropertyNumber, City, ZIPCode," +
"PropertyType, Bedrooms, YearBuilt, MarketValue)" +
"VALUES('917203', 'Alexandria', '22024'," +
"'Single Family', 3, 1965, 345660.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"PropertyType, Condition, Bedrooms, Bathrooms, MarketValue)" +
"VALUES('200417', '4140 Holisto Crt', 'Germantown', 'MD'," +
"'Condominium', 'Excellent', 2, 1, 215495.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('927474', '9522 Lockwood Rd', 'Chevy Chase', 'MD'," +
"'20852', 'Townhouse', 'Bad Shape', 3, 2.5, 3, 0, 3," +
"1992, 415665.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('207850', '14250 Parkdoll Rd', 'Rockville', 'MD'," +
"'20854', 'Townhouse', 'Good', 3, 2.5, 2, 1, 2," +
"1988, 325995.00);" +
"INSERT INTO Properties(City, PropertyType, Bedrooms," +
"YearBuilt, MarketValue)" +
"VALUES('Washington', 'Townhouse', 4, 1975, 366775.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"YearBuilt, MarketValue)" +
"VALUES('288540', '10340 Helmes Street #408', 'Silver Spring', 'MD'," +
"'20906', 'Condominium', 'Good', 1, 1, 2000, 242775.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('247472', '1008 Coppen Street', 'Silver Spring', 'MD'," +
"'20906', 'Single Family', 'Excellent'," +
"3, 3, 3, 1, 3, 1996, 625450.00);" +
"INSERT INTO Properties(City, ZIPCode, PropertyType, " +
"Stories, YearBuilt, MarketValue)" +
"VALUES('Chevy Chase', '20956', 'Single Family', " +
"3, 2001, 525450.00);" +
"INSERT INTO Properties(Address, City, State," +
"PropertyType, Condition, Bedrooms, MarketValue)" +
"VALUES('686 Herod Ave #D04', 'Takoma Park', 'MD'," +
"'Condominium', 'Excellent', 2, 360885.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('297446', '14005 Sniders Blvd', 'Laurel', 'MD'," +
"'20707', 'Townhouse', 'Needs Repair'," +
"4, 1.5, 3, 1, 2, 2002, 412885.00);" +
"INSERT INTO Properties(City, ZIPCode, Condition, Bedrooms," +
"Stories, YearBuilt)" +
"VALUES('Silver Spring', '20905', 'Good'," +
"4, 2, 1965);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('924792', '680 Prushia Rd', 'Washington', 'DC'," +
"'20008', 'Single Family', 'Good'," +
"5, 3.5, 3, 0, 3, 2000, 555885.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('294796', '14688 Parrison Street', 'College Park', 'MD'," +
"'20742', 'Single Family', 'Excellent'," +
"5, 2.5, 2, 1, 2, 1995, 485995.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"YearBuilt, MarketValue)" +
"VALUES('811155', '10340 Helmes Street #1012', 'Silver Spring'," +
"'MD', '20906', 'Condominium', 'Good'," +
"1, 1, 2000, 252775.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('447597', '4201 Vilamar Ave', 'Hyattsville', 'MD'," +
"'20782', 'Townhouse', 'Excellent'," +
"3, 2, 2, 1, 3, 1992, 365880.00);" +
"INSERT INTO Properties(Address, ZIPCode, Bathrooms)" +
"VALUES('1622 Rombard Str', 20904, 2.5);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('297415', '980 Phorwick Street', 'Washington', 'DC'," +
"'20004', 'Single Family', 'Good'," +
"4, 3.5, 3, 3, 1, 2004, 735475.00);" +
"INSERT INTO Properties(PropertyNumber, Address, City, State," +
"ZIPCode, PropertyType, Condition, Bedrooms, Bathrooms," +
"FinishedBasement, IndoorGarage, Stories, YearBuilt, MarketValue)" +
"VALUES('475974', '9015 Marvin Crow Ave', 'Gaithersburg', 'MD'," +
"'20872', 'Single Family', 'Needs Repair'," +
"4, 2.5, 3, 1, 1, 1965, 615775.00);";
SqlCommand cmdAltairRealtors1 =
new SqlCommand(strAltairRealtors1,
cnnAltairRealtors1);
cnnAltairRealtors1.Open();
cmdAltairRealtors1.ExecuteNonQuery();
MessageBox.Show("Some records have been created in the Properties table.");
}
}
}
}
|