-- oracleのUTL_FILEみたいなやつは存在しないようです
BULK INSERT dbo.table1 FROM '\\SERVER1\Directory\CSVFILE.CSV'
WITH (
DATAFILETYPE = 'char',
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
http://msdn.microsoft.com/ja-jp/library/ms188365.aspx
2010年5月19日水曜日
2010年5月18日火曜日
コンボボックスでほしいモノを検索して選択する
// コンボボックス:combo1 がテーブル:TABLE1 にバインドしており、
// カラム:COL1 の値が collumnvalue のものを選択させたいとき
int intPosition = this.tABLE1BindingSource.Find("COL1", collumnvalue);
if (intPosition == -1) { return; }
this.combo1.SelectedIndex = intPosition;
// カラム:COL1 の値が collumnvalue のものを選択させたいとき
int intPosition = this.tABLE1BindingSource.Find("COL1", collumnvalue);
if (intPosition == -1) { return; }
this.combo1.SelectedIndex = intPosition;
2010年5月13日木曜日
Fillしたデータを直接読み取る(複数行)
// Fillする
tABLEAdapter1.Fill(DataSet1.Table1);
// レコードセット(?)を取る
DataRowCollection drc1 = (DataRowCollection)dATASet.TABLE1.Rows;
// 一行ずつ読み取る
for (int i = 0; i < drc1.Count; i++)
{
DATASet.TABLE1Row drc2 = (DATASet.TABLE1Row)drc1[i];
Console.WriteLine(drc2.collumnname.ToString());
}
tABLEAdapter1.Fill(DataSet1.Table1);
// レコードセット(?)を取る
DataRowCollection drc1 = (DataRowCollection)dATASet.TABLE1.Rows;
// 一行ずつ読み取る
for (int i = 0; i < drc1.Count; i++)
{
DATASet.TABLE1Row drc2 = (DATASet.TABLE1Row)drc1[i];
Console.WriteLine(drc2.collumnname.ToString());
}
2010年5月10日月曜日
Fillしたデータを直接読み取る(単数行)
// Fillする
tABLEAdapter1.Fill(DataSet1.Table1);
// レコードセット(?)を取得
DataSet1.TABLE1Row rs = (DataSet1.TABLE1Row)((DataRowView)this.tABLE1BindingSource.Current).Row;
// レコードセットを参照する
Console.WriteLine(rs.collumnname.ToString());
tABLEAdapter1.Fill(DataSet1.Table1);
// レコードセット(?)を取得
DataSet1.TABLE1Row rs = (DataSet1.TABLE1Row)((DataRowView)this.tABLE1BindingSource.Current).Row;
// レコードセットを参照する
Console.WriteLine(rs.collumnname.ToString());
2010年4月21日水曜日
SQL server 2008 のバックアップを復元できない
ユーザーが違うと復元できなくなる設定があるらしい
コンパネ > サービス で、SQLサーバーのプロパティの
ログオン タブで、ローカルシステムアカウントにチェックを入れるらしい
http://hadairotype.blog64.fc2.com/blog-entry-17.html
コンパネ > サービス で、SQLサーバーのプロパティの
ログオン タブで、ローカルシステムアカウントにチェックを入れるらしい
http://hadairotype.blog64.fc2.com/blog-entry-17.html
2010年4月20日火曜日
C#でのフォームやらコントロールやらの位置
フォームの位置と大きさ
フォームの位置を変更する
this.Location = new Point(10, 10);
フォームの位置をデスクトップ座標で変更する
this.SetDesktopLocation(10, 50);
this.DesktopLocation = new Point(10, 50);
(どっちども同じ)
フォームの位置とサイズを変更する
//位置と大きさを変更(BoundsSpecified.Allは省略可能)
this.SetBounds(10, 50, 200, 100, BoundsSpecified.All);
//位置だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Location);
//大きさだけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Size);
//幅だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Width);
//高さだけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Height);
//X座標だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.X);
//Y座標だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Y);
//変更しない
this.SetBounds(10, 50, 200, 100, BoundsSpecified.None);
もしくは
this.Bounds = new Rectangle(10, 50, 200, 100);
フォームの位置を変更する
this.Location = new Point(10, 10);
フォームの位置をデスクトップ座標で変更する
this.SetDesktopLocation(10, 50);
this.DesktopLocation = new Point(10, 50);
(どっちども同じ)
フォームの位置とサイズを変更する
//位置と大きさを変更(BoundsSpecified.Allは省略可能)
this.SetBounds(10, 50, 200, 100, BoundsSpecified.All);
//位置だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Location);
//大きさだけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Size);
//幅だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Width);
//高さだけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Height);
//X座標だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.X);
//Y座標だけ変更
this.SetBounds(10, 50, 200, 100, BoundsSpecified.Y);
//変更しない
this.SetBounds(10, 50, 200, 100, BoundsSpecified.None);
もしくは
this.Bounds = new Rectangle(10, 50, 200, 100);
2010年4月1日木曜日
BindingSourceのFind
tableadapterをFillしてたら、検索ができます
// つかいかた
BindingSource01.Find([検索するカラム名(string型でOK)], [検索する値(string型でOK)]);
これで、Positionが int型で返ってくる
// 使ってみた
int intPosition = this.t_M_得意先くくりBindingSource.Find("くくりID", this.くくりIDTextBox.Text);
if (intPosition == -1) { return; }
Console.WriteLine( this.cCSLOGISTICSDataSet.T_M_得意先くくり.Rows[intPosition].ItemArray[0].ToString());
// つかいかた
BindingSource01.Find([検索するカラム名(string型でOK)], [検索する値(string型でOK)]);
これで、Positionが int型で返ってくる
// 使ってみた
int intPosition = this.t_M_得意先くくりBindingSource.Find("くくりID", this.くくりIDTextBox.Text);
if (intPosition == -1) { return; }
Console.WriteLine( this.cCSLOGISTICSDataSet.T_M_得意先くくり.Rows[intPosition].ItemArray[0].ToString());
登録:
投稿 (Atom)