C# Programming
CreateDB/CreateDB.sln
Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateDB", "CreateDB\CreateDB.csproj", "{DE5A614F-0411-4999-AB0B-F2DA1AF78A67}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x86 = Debug|x86 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {DE5A614F-0411-4999-AB0B-F2DA1AF78A67}.Debug|x86.ActiveCfg = Debug|x86 {DE5A614F-0411-4999-AB0B-F2DA1AF78A67}.Debug|x86.Build.0 = Debug|x86 {DE5A614F-0411-4999-AB0B-F2DA1AF78A67}.Release|x86.ActiveCfg = Release|x86 {DE5A614F-0411-4999-AB0B-F2DA1AF78A67}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal
CreateDB/CreateDB.suo
CreateDB/CreateDB/bin/Debug/CreateDB.exe
CreateDB/CreateDB/bin/Debug/CreateDB.pdb
CreateDB/CreateDB/bin/Debug/CreateDB.vshost.exe
CreateDB/CreateDB/bin/Debug/CreateDB.vshost.exe.manifest
CreateDB/CreateDB/CreateDB.csproj
Debug x86 8.0.30703 2.0 {DE5A614F-0411-4999-AB0B-F2DA1AF78A67} Exe Properties CreateDB CreateDB v4.0 Client 512 x86 true full false bin\Debug\ DEBUG;TRACE prompt 4 x86 pdbonly true bin\Release\ TRACE prompt 4
CreateDB/CreateDB/CreateDB.csproj.user
CreateDB/CreateDB/obj/x86/Debug/CreateDB.csproj.FileListAbsolute.txt
C:\Users\MIS\Desktop\CreateDB\CreateDB\bin\Debug\CreateDB.exe C:\Users\MIS\Desktop\CreateDB\CreateDB\bin\Debug\CreateDB.pdb C:\Users\MIS\Desktop\CreateDB\CreateDB\obj\x86\Debug\ResolveAssemblyReference.cache C:\Users\MIS\Desktop\CreateDB\CreateDB\obj\x86\Debug\CreateDB.exe C:\Users\MIS\Desktop\CreateDB\CreateDB\obj\x86\Debug\CreateDB.pdb W:\01 oit\MIS218-1 Spring 2013\Cxx Gittleman Database\CreateDB\CreateDB\obj\x86\Debug\CreateDB.exe W:\01 oit\MIS218-1 Spring 2013\Cxx Gittleman Database\CreateDB\CreateDB\obj\x86\Debug\CreateDB.pdb
CreateDB/CreateDB/obj/x86/Debug/CreateDB.exe
CreateDB/CreateDB/obj/x86/Debug/CreateDB.pdb
CreateDB/CreateDB/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
CreateDB/CreateDB/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Data.SqlClient; namespace CreateDB { class Program { static void Main(string[] args) { //Establish the syntax for the connection string String connect = "Data Source=" + @"OW206_VM\MIS218;" + "Initial Catalog=Sales;Integrated Security=True"; //establish the variable con as a new connection object for the sqlconnection class using the connect string defined above. SqlConnection con = new SqlConnection(connect); con.Open(); Console.WriteLine ("Made the connection to the Sales database"); SqlCommand cmd = con.CreateCommand(); // clear out existing datbase tables, comment out during the first execution //cmd.CommandText = "DROP TABLE Customer"; //cmd.ExecuteNonQuery(); //cmd.CommandText = "DROP TABLE Salesperson"; //cmd.ExecuteNonQuery(); //cmd.CommandText = "DROP TABLE Item"; //cmd.ExecuteNonQuery(); //cmd.CommandText = "DROP TABLE Orders"; //cmd.ExecuteNonQuery(); //cmd.CommandText = "DROP TABLE OrderItem"; //cmd.ExecuteNonQuery(); cmd.CommandText = "CREATE TABLE Customer (CustomerID " + "CHAR(4), CustomerName VARCHAR(25), Address " + "VARCHAR(25), BalanceDue DECIMAL)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Customer VALUES (1234,'Fred " + "Flynn','22 First St.',1667.00)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Customer VALUES " + "(5678,'Darnell Davis','33 Second St.',130.95)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Customer VALUES (4321,'Marla " + "Martinez','44 Third St.',0)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Customer VALUES (8765,'Carla " + "Kahn','55 Fourth St.', 0)"; cmd.ExecuteNonQuery(); cmd.CommandText = "CREATE TABLE Salesperson (SalespersonID CHAR(2), SalespersonName VARCHAR(25), " + "Address VARCHAR(25))"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Salesperson VALUES " + "(12,'Peter Patterson','66 Fifth St.')"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Salesperson VALUES " + "(98,'Donna Dubarian','77 Sixth St.')"; cmd.ExecuteNonQuery(); cmd.CommandText = "CREATE TABLE Item (ItemNumber CHAR(6)," + "Description VARCHAR(20), Quantity INTEGER)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Item VALUES (222222,'radio',32)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Item VALUES (333333,'television',14)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Item VALUES (444444,'computer',9)"; cmd.ExecuteNonQuery(); cmd.CommandText = "CREATE TABLE Orders (OrderNumber VARCHAR(4), CustomerID CHAR(4), SalespersonID CHAR(2), OrderDate DATE)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Orders VALUES (1,1234,12,'Apr 3, 1999')"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Orders VALUES (2,5678,12,'Mar 22, 1999')"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Orders VALUES (3,8765,98,'Feb 19, 1999')"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Orders VALUES (4,1234,12,'Apr 5, 1999')"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO Orders VALUES (5,8765,98,'Feb 28, 1999')"; cmd.ExecuteNonQuery(); cmd.CommandText = "CREATE TABLE OrderItem (OrderNumber " + "CHAR(4), ItemNumber CHAR(6), Quantity " + "INTEGER, UnitPrice DECIMAL)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO OrderItem VALUES (1,222222,4,27.00)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO OrderItem VALUES (1,333333,2,210.50)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO OrderItem VALUES (1,444444,1,569.00)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO OrderItem VALUES (2,333333,2,230.95)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO OrderItem VALUES (3,222222,3,27.00)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO OrderItem VALUES (3,333333,1,230.95)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO OrderItem VALUES (4,444444,1,569.00)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO OrderItem VALUES (5,222222,2,27.00)"; cmd.ExecuteNonQuery(); cmd.CommandText = "INSERT INTO OrderItem VALUES (5,444444,1,725.00)"; cmd.ExecuteNonQuery(); con.Close(); } } }
CreateDB/CreateDB/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("CreateDB")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CreateDB")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("f9fc1a46-ba91-471d-a2a6-767394c5e54c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]