小编sac*_*rni的帖子

SQL Server:将架构更改复制到另一个数据库

我正在研究ASP.NET Web API中的一个需求,它需要两个相同的数据库.

我在同一台服务器上创建了两个相同的数据库.假设一个用于开发,另一个用于测试.

我想立即将所有模式(如存储过程,视图和表)从另一个数据库复制到另一个数据库.

我并不担心数据复制,我只需要确保两个数据库具有完全相同的模式定义.

我已经尝试从一个数据库生成一个模式,并定期更新另一个.但现在,我想立即将更改复制到其他数据库.因此,当我更新开发数据库中的存储过程或视图时,也应立即对测试数据库应用相同的更改.

我要求你告诉我是否有可能或者是否有另一种方法来实现这一目标

database sql-server asp.net database-replication sql-server-2012

11
推荐指数
2
解决办法
578
查看次数

没有NgModel的提供者!将ngControl添加到bootstrap 4 TypeHead angular 2时,(Typeahead - > NgModel)异常

我试图在Angualr js 2中添加ngControl表单验证到bootstrap 4 typehead控件.代码如下.

<input [(ngModel)]="model.brand" [typeahead]="model.brands" ng-model-options="{'updateOn': 'blur'}"
        (typeaheadOnSelect)="brandOnSelect($event)" (typeaheadNoResults)="brandNoResults($event)"
        [typeaheadOptionField]="'Value'" class="form-control" ngcontrol="brand" >
        <div *ngIf="brand.dirty && !brand.valid ">
            <p  *ngIf="brand.errors.required" class="text-help">{{ required }}</p>
        </div>
Run Code Online (Sandbox Code Playgroud)

twitter-bootstrap-4 bootstrap-4 angular

8
推荐指数
1
解决办法
2538
查看次数

在类型脚本中将字符串/文本转换为字节数组

我目前正致力于在我的系统中以角度2(beta)版本使用安全API下载文件(PDF/excel/text).

我使用了带有身份验证标头的post API,并尝试使用收到的数据字节创建blob.

我尝试使用以下代码

return this.http.get(url, { headers: this.headers}).map( response => response.blob())
Run Code Online (Sandbox Code Playgroud)

但是,我得到的错误是在角度2 HTTP中没有实现blob方法.

所以我正在尝试下面的代码,我需要将字符串转换为字节数组.

return this.http.get(Configuration.API_URL + url, { headers: this.headers }).map(
            response => {
                var bytes = [];

                var utf8 = encodeURIComponent(response.text());
                for (var i = 0; i < utf8.length; i++) {
                    bytes.push(utf8.charCodeAt(i));
                }    
                var data = new Blob([bytes], { type: 'application/pdf' });
                var fileURL = URL.createObjectURL(data);
                window.open(fileURL);
            }
        );
Run Code Online (Sandbox Code Playgroud)

这里我面临一些字节数组的问题.字节数组与API发送的字节数组不同.

在将字符串转换为字节数组或在angular 2 HTTP get请求中使用blob时需要帮助.

blob http angularjs typescript angular

7
推荐指数
1
解决办法
9016
查看次数

角度为2 rc5的基于模型的形式不起作用

我正在将代码从角度beta迁移到RC5版本.我面临着使用的基于模型的表格的问题.因为我已经在角度2 beta中开发了很多形式.我很难将基于模型的表单更改为基于模板的表单.任何形式迁移的帮助都非常感谢.

我现有的代码是这样的

profile.ts

import {FORM_DIRECTIVES, REACTIVE_FORM_DIRECTIVES} from '@angular/forms';
import {FormBuilder, FormGroup, FormControl, Validators} from '@angular/forms';

 this.firstName = new FormControl();
        this.lastName = new FormControl();
        this.email = new FormControl();
        this.addressLine = new FormControl();
        this.postal = new FormControl();
        this.postalArea = new FormControl();

        this.form = builder.group({
            firstName: this.firstName,
            lastName: this.lastName,
            email: this.email,
            addressLine: this.addressLine,
            postal: this.postal,
            postalArea: this.postalArea,
            photo: this.photo
        });
Run Code Online (Sandbox Code Playgroud)

和profile中的模板.HTML如下

<form class="form-default"  [formGroup]="form">

<input type="text" class="form-control" id="firstName" [(ngModel)]="model.firstName" formControlName="firstName" maxlength="200">

    <input type="text" class="form-control" id="lastName" [(ngModel)]="model.lastName" formControlName="lastName" maxlength="200">
    <input type="text" class="form-control" id="email" …
Run Code Online (Sandbox Code Playgroud)

forms angular-rc5 angular

5
推荐指数
2
解决办法
3470
查看次数