//--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- public SqlCommand SQLCommand_Create(SqlConnection a_xSQLConnection) { string sSQLStatement = ""; sSQLStatement = $@" insert into CodeGen_Automobile ( AutomobileMake, AutomobileModel, AutomobileYear, AutomobileGUID ) values ( @AutomobileMake, @AutomobileModel, @AutomobileYear, @AutomobileGUID ) "; if (@AutomobileGUID == null) { AutomobileGUID = new GUID(); } SqlCommand xSQLCommand = new SqlCommand(sSQLStatement, a_xSQLConnection); xSQLCommand.Parameters.Add(new SqlParameter("@AutomobileMake", AutomobileMake.ToDBNull())); xSQLCommand.Parameters.Add(new SqlParameter("@AutomobileModel", AutomobileModel.ToDBNull())); xSQLCommand.Parameters.Add(new SqlParameter("@AutomobileYear", AutomobileYear.ToDBNull())); xSQLCommand.Parameters.Add(new SqlParameter("@AutomobileGUID", AutomobileGUID.ToString())); return(xSQLCommand); }
//--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- public SqlCommand SQLCommand_Update(SqlConnection a_xSQLConnection) { string sSQLStatement = ""; sSQLStatement = $@" update CodeGen_Automobile set AutomobileMake = @AutomobileMake, AutomobileModel = @AutomobileModel, AutomobileYear = @AutomobileYear where AutomobileGUID = @AutomobileGUID "; SqlCommand xSQLCommand = new SqlCommand(sSQLStatement, a_xSQLConnection); xSQLCommand.Parameters.Add(new SqlParameter("@AutomobileMake", AutomobileMake.ToDBNull())); xSQLCommand.Parameters.Add(new SqlParameter("@AutomobileModel", AutomobileModel.ToDBNull())); xSQLCommand.Parameters.Add(new SqlParameter("@AutomobileYear", AutomobileYear.ToDBNull())); xSQLCommand.Parameters.Add(new SqlParameter("@AutomobileGUID", AutomobileGUID.ToString())); return(xSQLCommand); }