Calling a form method from another form. You can solved it, using the Window.Owner property. But only top-level controls can have an owner.
Нэг формоос нөгөө формын функцийг дуудах. Нэг формоос өөр формыг дуудахдаа ShowDialog функц ашигласанаар хоёр форм хоорондоо харилцаа холбоотой болдог. Харин Show функээр дуудвал хоёр форм хоорондоо холбоогүй дуудагддаг. Show функцээр дуудсан үед тухайн хоёр формын холбоог Window.Owner property -г хэрэглэн үүсгэж болно.
Example:
//Form1 coding
private void button1_Click(object sender, EventArgs e)
{
this.label1.Text = "Hello World!";
}
public void updateForm()
{
button1_Click(this.button1, null);
}
private void button2_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Owner = this;
//f2.frmTemp = this;
f2.Show();
}
//Form2 coding
//public Form frmTemp;
private void button1_Click(object sender, EventArgs e)
{
(this.Owner as Form1).updateForm();
//(this.frmTemp as Form1).updateForm();
}
Thanks,
Info source: http://msdn.microsoft.com/en-us/library/system.windows.window.owner.aspx
Google adsense
Search
Monday, September 20, 2010
Monday, September 13, 2010
Django: PyDev plugin for Eclipse
Go to the update manager (Help > Install New Software), add:
http://pydev.org/updates
Thanks,
Info source: http://pydev.org/download.html
http://pydev.org/updates
Thanks,
Info source: http://pydev.org/download.html
Tuesday, September 7, 2010
Oracle: Usage
Талбаруудын өгөгдлийн төрлийг харах.
Select the column datatype using case when, concat function.
SELECT column_name,
CASE
WHEN data_type = 'DATE' then data_type
WHEN data_type = 'NUMBER' then concat( concat( concat( data_type, '(' ), concat( data_precision, case when data_scale > 0 then concat( ',', data_scale) end ) ), ')' )
WHEN data_type = 'NVARCHAR2' then concat( concat( concat( data_type, '(' ), char_length), ')' )
WHEN data_type = 'VARCHAR2' then concat( concat( concat( data_type, '(' ), concat( char_length, case char_used when 'B' then ' BYTE' end ) ), ')' )
END data_type
FROM user_tab_columns
WHERE table_name='table_name' AND (
column_name = 'columnname1' OR
column_name = 'columnname2' OR
column_name = 'columnname3'
) order by column_name;
Output:
COLUMN_NAME DATA_TYPE
columnname1 NUMBER(4)
columnname2 VARCHAR2(15 BYTE)
columnname3 DATE
Select the column datatype using case when, concat function.
SELECT column_name,
CASE
WHEN data_type = 'DATE' then data_type
WHEN data_type = 'NUMBER' then concat( concat( concat( data_type, '(' ), concat( data_precision, case when data_scale > 0 then concat( ',', data_scale) end ) ), ')' )
WHEN data_type = 'NVARCHAR2' then concat( concat( concat( data_type, '(' ), char_length), ')' )
WHEN data_type = 'VARCHAR2' then concat( concat( concat( data_type, '(' ), concat( char_length, case char_used when 'B' then ' BYTE' end ) ), ')' )
END data_type
FROM user_tab_columns
WHERE table_name='table_name' AND (
column_name = 'columnname1' OR
column_name = 'columnname2' OR
column_name = 'columnname3'
) order by column_name;
Output:
COLUMN_NAME DATA_TYPE
columnname1 NUMBER(4)
columnname2 VARCHAR2(15 BYTE)
columnname3 DATE
Oracle: Concat Function
In Oracle/PLSQL, the concat function allows you to concatenate two strings together.
The syntax for the concat function is:
concat( string1, string2 )
Хоёр текстийг хооронд нь холбоно.
The syntax for the concat function is:
concat( string1, string2 )
string1 is the first string to concatenate.
string2 is the second string to concatenate.
Applies To:
• Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g
For example:
concat('Tech on', ' the Net'); would return 'Tech on the Net'.
concat('a', 'b') would return 'ab'.
Thanks,
Info source: http://www.techonthenet.com/oracle/functions/concat.php
string2 is the second string to concatenate.
Applies To:
• Oracle 8i, Oracle 9i, Oracle 10g, Oracle 11g
For example:
concat('Tech on', ' the Net'); would return 'Tech on the Net'.
concat('a', 'b') would return 'ab'.
Thanks,
Info source: http://www.techonthenet.com/oracle/functions/concat.php
Oracle: Case when
case when x = y then a else b end
case when x < y then a when x = y then b else c end
case XYZ when 'foo' then 'moo' else 'bar' end
select a,
case
when b = '*' then 'star'
when b = '+' then 'plus'
when b = '-' then 'minus'
else '????'
end
from table_test_case_when;
Thanks,
Info source: http://www.adp-gmbh.ch/ora/sql/case_when.html
Monday, September 6, 2010
Oracle: Alter table
The ALTER TABLE statement allows you to rename an existing table. It can also be used to add, modify, or drop a column from an existing table.
Renaming a table
The basic syntax for renaming a table is:
ALTER TABLE table_name
RENAME TO new_table_name;
Adding column(s) to a table
Syntax #1
To add a column to an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
ADD column_name column-definition;
Syntax #2
To add multiple columns to an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
ADD ( column_1 column-definition,
column_2 column-definition,
...
column_n column_definition );
Modifying column(s) in a table
Syntax #1
To modify a column in an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
MODIFY column_name column_type;
Syntax #2
To modify multiple columns in an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
MODIFY ( column_1 column_type,
column_2 column_type,
...
column_n column_type );
Drop column(s) in a table
Syntax #1
To drop a column in an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
DROP COLUMN column_name;
Rename column(s) in a table
(NEW in Oracle 9i Release 2)
Syntax #1
Starting in Oracle 9i Release 2, you can now rename a column.
To rename a column in an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
RENAME COLUMN old_name to new_name;
Renaming a table
The basic syntax for renaming a table is:
ALTER TABLE table_name
RENAME TO new_table_name;
Adding column(s) to a table
Syntax #1
To add a column to an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
ADD column_name column-definition;
Syntax #2
To add multiple columns to an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
ADD ( column_1 column-definition,
column_2 column-definition,
...
column_n column_definition );
Modifying column(s) in a table
Syntax #1
To modify a column in an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
MODIFY column_name column_type;
Syntax #2
To modify multiple columns in an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
MODIFY ( column_1 column_type,
column_2 column_type,
...
column_n column_type );
Drop column(s) in a table
Syntax #1
To drop a column in an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
DROP COLUMN column_name;
Rename column(s) in a table
(NEW in Oracle 9i Release 2)
Syntax #1
Starting in Oracle 9i Release 2, you can now rename a column.
To rename a column in an existing table, the ALTER TABLE syntax is:
ALTER TABLE table_name
RENAME COLUMN old_name to new_name;
Friday, September 3, 2010
Oracle: select column names and types
Хүснэгтийн талбарын нэр, төрлийг сонгож авах
select column_name, data_type, data_length
from user_tab_columns
where table_name = 'MY_TABLE';
select * from all_tab_columns where owner = 'THE_SCHEMA_OWNER';
thanks Dr. Xi (http://www.xinotes.org/notes/note/521/)
select column_name, data_type, data_length
from user_tab_columns
where table_name = 'MY_TABLE';
select * from all_tab_columns where owner = 'THE_SCHEMA_OWNER';
thanks Dr. Xi (http://www.xinotes.org/notes/note/521/)
Subscribe to:
Posts (Atom)