using System.Windows.Forms;
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Enter)
{
SendKeys.Send("{TAB}");
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
2011年11月30日 星期三
{VB6}透過週期找出所屬週期的第一日日期
以下範例為
A:2011/01/01為第一周,則第二週的第一日日期為何?Q:2011/01/03
Private Sub Command1_Click()
Dim iDate As Date '指定第一周日期
Dim i As Long '指定週數
iDate = "2011-01-01"
i = 2
iDate = iDate + (i - 1) * 7 - 1
'Weekday(第一周日期,星期幾為新的一週)
iDate = iDate - Weekday(iDate, vbMonday) + 1
'結果顯示
Label1.Caption = iDate
End Sub
A:2011/01/01為第一周,則第二週的第一日日期為何?Q:2011/01/03
Private Sub Command1_Click()
Dim iDate As Date '指定第一周日期
Dim i As Long '指定週數
iDate = "2011-01-01"
i = 2
iDate = iDate + (i - 1) * 7 - 1
'Weekday(第一周日期,星期幾為新的一週)
iDate = iDate - Weekday(iDate, vbMonday) + 1
'結果顯示
Label1.Caption = iDate
End Sub
{C#-SQL資料庫}OleDb connection寫法
OleDbConnection conn = new OleDbConnection();
OleDbCommand cmd = new OleDbCommand();
conn.ConnectionString = @"Provider=MSDAORA;Data Source=xxxx;User Id=xxxxx;Password=xxxxxx;";
//conn.ConnectionString = ConfigurationManager.ConnectionStrings["cimdb-ConfigLab"].ConnectionString;
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = @"select * From abc where aufnr ='xx' ";
conn.Open();
//取得第一筆第一欄資料
object s = cmd.ExecuteScalar();
conn.Close();
this.textBox1.Text = s.ToString();
OleDbCommand cmd = new OleDbCommand();
conn.ConnectionString = @"Provider=MSDAORA;Data Source=xxxx;User Id=xxxxx;Password=xxxxxx;";
//conn.ConnectionString = ConfigurationManager.ConnectionStrings["cimdb-ConfigLab"].ConnectionString;
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = @"select * From abc where aufnr ='xx' ";
conn.Open();
//取得第一筆第一欄資料
object s = cmd.ExecuteScalar();
conn.Close();
this.textBox1.Text = s.ToString();
訂閱:
文章 (Atom)