Margin Border and Padding Reference
http://www.w3.org/TR/css3-box
Saturday, August 30, 2008
Friday, August 29, 2008
Transparent DIV SPAN for Internet Explorer, Firefox
Style sheet:
Apply code:
.transparency
{
filter:alpha(opacity=60);
-moz-opacity: 0.6;
opacity: 0.6;
}
{
filter:alpha(opacity=60);
-moz-opacity: 0.6;
opacity: 0.6;
}
Apply code:
<div class="transparency">A transparent div.</div>
<img src="image_basic.jpg" alt="Sample" class="transparency" />
<img src="image_basic.jpg" alt="Sample" class="transparency" />
Labels:
CSS,
HTML XHTML
Thursday, August 21, 2008
How to vertical align the text within a text box
Use padding-top tab in CSS style.
For an example
Result
For an example
<input type="text" style="width:140px; height:24px; padding-top:4px; font-family:Tahoma; font-size:18px" />
Result
Labels:
CSS,
HTML XHTML
SQL Server ROUND FLOOR CEILING function
SELECT ROUND(100.1145,2)
SELECT ROUND(100.1145,3)
GO
SELECT ROUND(123.45,-3), ROUND(123.45,-2), ROUND(123.45,-1), ROUND(123.45,0), ROUND(123.45,1), ROUND(123.45,2)
GO
SELECT FLOOR(123.45), FLOOR(-123.45), FLOOR($123.45), FLOOR($-123.45), FLOOR(123.9)
GO
SELECT CEILING(123.45), CEILING(-123.45), CEILING($123.45), CEILING($-123.45), CEILING(123.1)
GO
DECLARE @m MONEY
SET @m = 120.155 --SELECT @m = 120.155
SELECT @m
SELECT CONVERT(VARCHAR,@m)
GO
SELECT ROUND(100.1145,3)
GO
SELECT ROUND(123.45,-3), ROUND(123.45,-2), ROUND(123.45,-1), ROUND(123.45,0), ROUND(123.45,1), ROUND(123.45,2)
GO
SELECT FLOOR(123.45), FLOOR(-123.45), FLOOR($123.45), FLOOR($-123.45), FLOOR(123.9)
GO
SELECT CEILING(123.45), CEILING(-123.45), CEILING($123.45), CEILING($-123.45), CEILING(123.1)
GO
DECLARE @m MONEY
SET @m = 120.155 --SELECT @m = 120.155
SELECT @m
SELECT CONVERT(VARCHAR,@m)
GO
Labels:
SQL Server
Monday, August 11, 2008
SQL Server Linked Server
Query from link server
for default instance name
for other instance name
other method
for default instance name
SELECT * FROM [LinkServerName].DatabaseName.dbo.TableName
SELECT * FROM OPENQUERY([LinkServerName], 'SELECT * FROM TableName')
SELECT * FROM OPENQUERY([LinkServerName], 'SELECT * FROM TableName')
for other instance name
SELECT * FROM [LinkServerName\InstanceName].DatabaseName.dbo.TableName
SELECT * FROM OPENQUERY([LinkServerName\InstanceName], 'SELECT * FROM TableName')
SELECT * FROM OPENQUERY([LinkServerName\InstanceName], 'SELECT * FROM TableName')
other method
SELECT * FROM LinkServerName..UserName.TableName
Labels:
Oracle,
SQL Server
Friday, August 8, 2008
How to run SQL Server job using ASP.NET C#
Method 1. Using Store Procedure
Comming soon...
http://blog.the-dargans.co.uk/2007/02/executing-job-on-sql-2005-server-in-c.html
http://www.dotnetspider.com/resources/4833-Read-status-SQL-Server-Agent-jobs.aspx
http://www.dotaspx.net/article4.aspx
http://www.sqlteam.com/article/how-to-asynchronously-execute-a-dts-package-from-asp-or-aspnet
http://forums.asp.net/t/1271752.aspx
http://dreamsender.blogspot.com/2008/07/run-job-scheduled-sql-server-aspnet.html
http://www.greatfriends.biz/webboards/msg.asp?b=SURREALIST&id=76368
Comming soon...
http://blog.the-dargans.co.uk/2007/02/executing-job-on-sql-2005-server-in-c.html
http://www.dotnetspider.com/resources/4833-Read-status-SQL-Server-Agent-jobs.aspx
http://www.dotaspx.net/article4.aspx
http://www.sqlteam.com/article/how-to-asynchronously-execute-a-dts-package-from-asp-or-aspnet
http://forums.asp.net/t/1271752.aspx
http://dreamsender.blogspot.com/2008/07/run-job-scheduled-sql-server-aspnet.html
http://www.greatfriends.biz/webboards/msg.asp?b=SURREALIST&id=76368
Labels:
ASP.NET,
C#,
SQL Server
Thursday, August 7, 2008
Oracle SQL *Plus write text to screen
SQL> set serveroutput on;
SQL> begin
2 dbms_output.put_line('Test ' || 'concat');
3 end;
4 /
Test concat
SQL> begin
2 dbms_output.put_line('Test ' || 'concat');
3 end;
4 /
Test concat
Labels:
Oracle
How to use trigger on Oracle
Prepare table
Create trigger
Test the trigger
View result on t1_audit
http://infolab.stanford.edu/~ullman/fcdb/oracle/or-triggers.html
http://www.psoug.org/reference/table_trigger.html
http://www.exforsys.com/tutorials/oracle-9i/oracle-database-triggers.html
http://somkiat.exteen.com/20040715/trigger-short-tutorial
CREATE TABLE t1
(
c1 INTEGER,
c2 VARCHAR(10),
c3 VARCHAR(10)
)
CREATE TABLE t1_audit
(
a1 DATE,
a2 VARCHAR(3),
c1 INTEGER,
c2 VARCHAR(10),
c3 VARCHAR(10)
)
insert into t1 values (1,'111','aaa');
insert into t1 values (2,'222','bbb');
insert into t1 values (3,'333','ccc');
insert into t1 values (4,'444','ddd');
(
c1 INTEGER,
c2 VARCHAR(10),
c3 VARCHAR(10)
)
CREATE TABLE t1_audit
(
a1 DATE,
a2 VARCHAR(3),
c1 INTEGER,
c2 VARCHAR(10),
c3 VARCHAR(10)
)
insert into t1 values (1,'111','aaa');
insert into t1 values (2,'222','bbb');
insert into t1 values (3,'333','ccc');
insert into t1 values (4,'444','ddd');
Create trigger
CREATE OR REPLACE TRIGGER t1_trig
AFTER UPDATE ON t1
FOR EACH ROW
BEGIN
IF(:NEW.c2 IS NULL) THEN
INSERT INTO t1_audit VALUES (SYSDATE, 'OLD', :OLD.c1, :OLD.c2, :OLD.c3);
INSERT INTO t1_audit VALUES (SYSDATE, 'NEW', :NEW.c1, :NEW.c2, :NEW.c3);
END IF;
END;
or use this command
CREATE OR REPLACE TRIGGER t1_trig
AFTER UPDATE ON t1
FOR EACH ROW
WHEN (NEW.c2 IS NULL)
BEGIN
INSERT INTO t1_audit VALUES (SYSDATE, 'OLD', :OLD.c1, :OLD.c2, :OLD.c3);
INSERT INTO t1_audit VALUES (SYSDATE, 'NEW', :NEW.c1, :NEW.c2, :NEW.c3);
END;
AFTER UPDATE ON t1
FOR EACH ROW
BEGIN
IF(:NEW.c2 IS NULL) THEN
INSERT INTO t1_audit VALUES (SYSDATE, 'OLD', :OLD.c1, :OLD.c2, :OLD.c3);
INSERT INTO t1_audit VALUES (SYSDATE, 'NEW', :NEW.c1, :NEW.c2, :NEW.c3);
END IF;
END;
or use this command
CREATE OR REPLACE TRIGGER t1_trig
AFTER UPDATE ON t1
FOR EACH ROW
WHEN (NEW.c2 IS NULL)
BEGIN
INSERT INTO t1_audit VALUES (SYSDATE, 'OLD', :OLD.c1, :OLD.c2, :OLD.c3);
INSERT INTO t1_audit VALUES (SYSDATE, 'NEW', :NEW.c1, :NEW.c2, :NEW.c3);
END;
Test the trigger
UPDATE t1
SET t1.c2 = ''
WHERE t1.c1 = 3;
SET t1.c2 = ''
WHERE t1.c1 = 3;
View result on t1_audit
07/08/2008 14:26:02 OLD 3 333 ccc
07/08/2008 14:26:02 NEW 3 ccc
07/08/2008 14:26:02 NEW 3 ccc
http://infolab.stanford.edu/~ullman/fcdb/oracle/or-triggers.html
http://www.psoug.org/reference/table_trigger.html
http://www.exforsys.com/tutorials/oracle-9i/oracle-database-triggers.html
http://somkiat.exteen.com/20040715/trigger-short-tutorial
Labels:
Oracle
Wednesday, August 6, 2008
ความหมายของ PO PR
PO = Purchase Order คือใบสั่งซื้อที่เราจะส่งให้ผู้ขายเพื่อขอสั่งซื้อสินค้า
PR = Purchase Request หรือ Purchase Requisition ก็คือเอกสารภายใน คือเป็นใบขอสั่งซื้อที่ทางแผนกที่ต้องการสินค้าจะจัดตรียมขึ้นมาแล้วส่งไปให้ทางผู้จัดการฝ่ายลงชื่ออนุมัติสั่งซื้อ แล้วค่อยส่งต่อไปให้ฝ่ายจัดซื้อเพื่อดำเนินการสั่งซื้อสินค้าหรือจ้างทำของต่อไป
ในการสั่งซื้อสินค้า เราต้องทำการออก PR ให้แผนกจัดซื้อก่อน หลังจากนั้นแผนกจัดซื้อก็ทำการใส่ราคาที่จัดหามาได้
เมือได้ราคาแล้วเราก็สามารถออก PO เพื่อส่งให้ผู้ขายได้ครับ
PR = Purchase Request หรือ Purchase Requisition ก็คือเอกสารภายใน คือเป็นใบขอสั่งซื้อที่ทางแผนกที่ต้องการสินค้าจะจัดตรียมขึ้นมาแล้วส่งไปให้ทางผู้จัดการฝ่ายลงชื่ออนุมัติสั่งซื้อ แล้วค่อยส่งต่อไปให้ฝ่ายจัดซื้อเพื่อดำเนินการสั่งซื้อสินค้าหรือจ้างทำของต่อไป
ในการสั่งซื้อสินค้า เราต้องทำการออก PR ให้แผนกจัดซื้อก่อน หลังจากนั้นแผนกจัดซื้อก็ทำการใส่ราคาที่จัดหามาได้
เมือได้ราคาแล้วเราก็สามารถออก PO เพื่อส่งให้ผู้ขายได้ครับ
Labels:
Accounting
How to delete file from ASP.NET
Import System.IO namespace
and use this code
using System.IO
and use this code
try {
FileInfo TheFile = new FileInfo(MapPath(".") + "\\" + txtFile.Text);
if (TheFile.Exists) {
File.Delete(MapPath(".") + "\\" + txtFile.Text);
}
else {
throw new FileNotFoundException();
}
}
catch (FileNotFoundException ex) {
lblStatus.Text += ex.Message;
}
catch (Exception ex) {
lblStatus.Text += ex.Message;
}
FileInfo TheFile = new FileInfo(MapPath(".") + "\\" + txtFile.Text);
if (TheFile.Exists) {
File.Delete(MapPath(".") + "\\" + txtFile.Text);
}
else {
throw new FileNotFoundException();
}
}
catch (FileNotFoundException ex) {
lblStatus.Text += ex.Message;
}
catch (Exception ex) {
lblStatus.Text += ex.Message;
}
Labels:
ASP.NET
Tuesday, August 5, 2008
How to insert values into an identity column in SQL Server
USE Northwind
GO
IF OBJECT_ID('IdentityTable') IS NOT NULL
DROP TABLE IdentityTable
GO
CREATE TABLE IdentityTable (
TheIdentity INT NOT NULL IDENTITY(1,1) PRIMARY KEY,
TheValue NVARCHAR(20) NOT NULL )
GO
GO
IF OBJECT_ID('IdentityTable') IS NOT NULL
DROP TABLE IdentityTable
GO
CREATE TABLE IdentityTable (
TheIdentity INT NOT NULL IDENTITY(1,1) PRIMARY KEY,
TheValue NVARCHAR(20) NOT NULL )
GO
INSERT IdentityTable(TheIdentity, TheValue)
VALUES (1, 'First Row')
GO
VALUES (1, 'First Row')
GO
Server: Msg 544, Level 16, State 1, Line 1
Cannot insert explicit value for identity column in table 'IdentityTable' when IDENTITY_INSERT is set to OFF.
SET IDENTITY_INSERT IdentityTable ON
INSERT IdentityTable(TheIdentity, TheValue)
VALUES (3, 'First Row')
SET IDENTITY_INSERT IdentityTable OFF
INSERT IdentityTable(TheIdentity, TheValue)
VALUES (3, 'First Row')
SET IDENTITY_INSERT IdentityTable OFF
SET IDENTITY_INSERT IdentityTable ON
INSERT IdentityTable(TheIdentity, TheValue)
VALUES (10, 'Row Ten')
SET IDENTITY_INSERT IdentityTable OFF
INSERT IdentityTable(TheValue)
VALUES ('Should be 11')
SELECT * FROM IdentityTable
GO
INSERT IdentityTable(TheIdentity, TheValue)
VALUES (10, 'Row Ten')
SET IDENTITY_INSERT IdentityTable OFF
INSERT IdentityTable(TheValue)
VALUES ('Should be 11')
SELECT * FROM IdentityTable
GO
Result
---------------------
1 First Row
10 Row Ten
11 Should be 11
Labels:
SQL Server
Show row number in SQL Server and Oracle
SQL Server:
Show row number in SQL Server 2000, 2005
http://support.microsoft.com/kb/186133
Oracle:
Show row number in Oracle
http://blog.lishman.com/2008/03/rownum.html
USE Northwind
SELECT ROW_NUMBER() OVER (ORDER BY EmployeeID DESC) AS RowID, *
FROM EMPLOYEES ORDER BY FirstName
SELECT ROW_NUMBER() OVER (ORDER BY EmployeeID DESC) AS RowID, *
FROM EMPLOYEES ORDER BY FirstName
Show row number in SQL Server 2000, 2005
http://support.microsoft.com/kb/186133
Oracle:
SELECT rownum, column_name FROM user_tables
Show row number in Oracle
http://blog.lishman.com/2008/03/rownum.html
Labels:
Oracle,
SQL Server
Subscribe to:
Posts (Atom)