Wednesday, August 6, 2008

Upload file using ASP.NET 2.0

test

ความหมายของ PO PR

PO = Purchase Order คือใบสั่งซื้อที่เราจะส่งให้ผู้ขายเพื่อขอสั่งซื้อสินค้า

PR = Purchase Request หรือ Purchase Requisition ก็คือเอกสารภายใน คือเป็นใบขอสั่งซื้อที่ทางแผนกที่ต้องการสินค้าจะจัดตรียมขึ้นมาแล้วส่งไปให้ทางผู้จัดการฝ่ายลงชื่ออนุมัติสั่งซื้อ แล้วค่อยส่งต่อไปให้ฝ่ายจัดซื้อเพื่อดำเนินการสั่งซื้อสินค้าหรือจ้างทำของต่อไป

ในการสั่งซื้อสินค้า เราต้องทำการออก PR ให้แผนกจัดซื้อก่อน หลังจากนั้นแผนกจัดซื้อก็ทำการใส่ราคาที่จัดหามาได้
เมือได้ราคาแล้วเราก็สามารถออก PO เพื่อส่งให้ผู้ขายได้ครับ

How to delete file from ASP.NET

Import System.IO namespace
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;
}

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

INSERT IdentityTable(TheIdentity, TheValue)
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

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

Result
---------------------
1 First Row
10 Row Ten
11 Should be 11

Show row number in SQL Server and Oracle

SQL Server:
USE Northwind
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

Friday, July 18, 2008

Command to view Environtment Variable

Start -> Run -> Type set and enter