小编Har*_*olu的帖子

如何使用jdbc中的ResultSet.getBinaryStream()从所有列获取值?

如何使用jdbc将整个表写入平面文件(文本文件)?到目前为止,我尝试了以下内容:

Statement statement = connection.createStatement();
   ResultSet result = statement.executeQuery("SELECT * FROM tablename");
   BufferedInputStream buffer;
   FileOutputStream out = new FileOutputStream("flatfile.txt");
   while(result.next() )
   {
      buffer =  new BufferedInputStream(result.getBinaryStream("????") );
      byte[] buf = new byte[4 * 1024]; //4K buffer
      int len;
      while( (len = buffer.read(buf, 0, buf.length) ) != -1 )
      {
          out.write(buf, 0, len );
      }
   }
   out.close();
Run Code Online (Sandbox Code Playgroud)

"????" 只是我的占位符.我被困在作为论点传递的内容上.

java sql db2 jdbc resultset

22
推荐指数
3
解决办法
5万
查看次数

TypeError:this.form._updateTreeValidity不是函数

我目前正在使用Angular Forms版本2.0.0,并尝试使用联系表单内部联系我们模式.

在ContactComponent加载后,我得到:

EXCEPTION:this.form._updateTreeValidity不是函数

不能罚款this.form._updateTreeValidity

  1. 我已经看到一些其他的堆栈帖子暗示使用FormGroup而不是FormBuilder来初始化组件构造函数中的表单对象现在是新API的标准,所以我已经更新了.

  2. 我导入ReactiveFormsModule和FormsModule以及所有与表单相关的组件,并且错误似乎与模块无关.

  3. 我的TypeScript不会在编译时抛出错误,Visual Studio Intellisense似乎能够很好地找到所有FormGroup函数,为什么会在运行时发生这种情况?...

我的代码:

contact.component.ts:

import { Component, Input, ViewChild } from '@angular/core';
import { ApiService } from '../../../services/api.service';
import { ModalComponent } from 'ng2-bs3-modal/ng2-bs3-modal';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { FormsModule, ReactiveFormsModule, FormGroup, FormControl, Validators } from '@angular/forms';
import 'rxjs/Rx';

declare var jQuery: any;

@Component({
    selector: 'my-contact',
    templateUrl: 'app/modules/footer/contact/contact.html'
})
export class ContactComponent {

    private contactForm: FormGroup;
    private invalidEmail: boolean;
    private invalidSubject: boolean;
    private invalidMessage: boolean;

    constructor(private apiService: ApiService, …
Run Code Online (Sandbox Code Playgroud)

javascript validation typescript angular2-forms angular

18
推荐指数
2
解决办法
2万
查看次数