2010年4月21日水曜日

SQL server 2008 のバックアップを復元できない

ユーザーが違うと復元できなくなる設定があるらしい

コンパネ > サービス で、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);

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());

2010年3月18日木曜日

テーブルの型を変更できないとき SQL-server2008

SQL Server 2008 でテーブルを保存するときにエラー メッセージ "変更の保存が許可されていません" が表示される

1. SQL Server Management Studio (SSMS) を開きます。
2. [ツール] メニューの [オプション] をクリックします。
3. [オプション] ウィンドウのナビゲーション ウィンドウで、[Designers] をクリックします。
4. [テーブルの再作成を必要とする変更を保存できないようにする] チェック ボックスをオンまたはオフにして、[OK] をクリックします。

http://support.microsoft.com/kb/956176/ja

2010年3月5日金曜日

カスタムプロパティ

// リスト選択型のプロパティ
public enum enumTest{a = 10,b = 20};
[Category("Design")]
[Description("テスト")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
private enumTest et;
public enumTest TestProperty
{
set { et = value; }
get { return et; }
}

// ツリー型のプロパティ
private Size st;
[Category("Design")]
[Description("テスト2")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Size TestProperty2
{
set { st = value; }
get { return st; }
}

2010年3月3日水曜日

今走っているメソッドを知る!!

方法①
System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
Console.WriteLine(st.GetFrame(0).ToString());

方法②
Console.WriteLine(System.Reflection.MethodBase.GetCurrentMethod().Name);

エラーログなんかで便利そう

2010年2月6日土曜日