Tools -> Internet
Search This Blog
Wednesday, April 7, 2010
Monday, February 22, 2010
Added Microsoft Access as linked server SQL Server
SQL Server > Linked Server > Add
sp_addlinkedserver
Creates a linked server. A linked server allows for access to distributed, heterogeneous queries against OLE DB data sources
sp_addlinkedsrvlogin
Creates or updates a mapping between a login on the local instance of SQL Server and a security account on a remote server.
GO
-- To use named parameters:
EXEC sp_addlinkedserver
@server = 'ACCES',
@provider = 'Microsoft.Jet.OLEDB.4.0',
@srvproduct = 'OLE DB Provider for Jet',
@datasrc = 'D:\data\DB1.mdb'
GO
sp_addlinkedserver
Creates a linked server. A linked server allows for access to distributed, heterogeneous queries against OLE DB data sources
sp_addlinkedsrvlogin
Creates or updates a mapping between a login on the local instance of SQL Server and a security account on a remote server.
Example: Add Microsoft Access as linked server SQL Server
USE masterGO
-- To use named parameters:
EXEC sp_addlinkedserver
@server = 'ACCES',
@provider = 'Microsoft.Jet.OLEDB.4.0',
@srvproduct = 'OLE DB Provider for Jet',
@datasrc = 'D:\data\DB1.mdb'
GO
-- set password
EXEC sp_addlinkedsrvlogin 'ACCES', false, 'sa', 'Admin', NULL
Etichete:
SQL Server
Thursday, February 4, 2010
First, last day of the month Oracle
Oracle > Date & Time > First day and last day of the month Oracle
-----------
12/1/2010
LAST_DATE
-----------
12/31/2010
SELECT (trunc(sysdate, 'mm')) first_day FROM dual;
SELECT last_day(trunc(sysdate)) last_date FROM dual;
--result
FIRST_DAY-----------
12/1/2010
LAST_DATE
-----------
12/31/2010
Etichete:
Oracle/PLSQL
Tuesday, January 26, 2010
Duplicate rows SQL Server
SQL Server > Scripts > Duplicate rows SQL Server
Here is a script to find number of duplicate rows in SQL Server
GO
id int ,
name varchar(50)
);
GO
count(name) 'Number of duplicate rows'
FROM
tbl1
GROUP BY
id
HAVING
count(name) > 1
GO
Result:
id Number of duplicate rows
1 2
Here is a script to find number of duplicate rows in SQL Server
IF OBJECT_ID(N'tbl1', N'U') IS NOT NULL
DROP TABLE tbl1;GO
CREATE TABLE tbl1
(id int ,
name varchar(50)
);
GO
INSERT INTO tbl1 values (1,'john'), (2,'dan') , (1,'john')
GOSELECT
id, count(name) 'Number of duplicate rows'
FROM
tbl1
GROUP BY
id
HAVING
count(name) > 1
GO
Result:
id Number of duplicate rows
1 2
Etichete:
SQL Server
Wednesday, January 20, 2010
send fax C#
Send fax C# using using FAXCOMLib;
public void SendFax(string DocumentName, string FileName, string RecipientName, string FaxNumber)
{
FAXCOMLib.FaxServer faxServer = new FAXCOMLib.FaxServerClass();
faxServer.Connect(Environment.MachineName);
FAXCOMLib.FaxDoc faxDoc = (FAXCOMLib.FaxDoc)faxServer.CreateDocument(FileName);
faxDoc.RecipientName = RecipientName;
faxDoc.FaxNumber = FaxNumber;
faxDoc.Tsid = "Fax";
faxDoc.DisplayName = DocumentName;
int Response = faxDoc.Send();
faxServer.Disconnect();
}
Etichete:
c#
Tuesday, January 19, 2010
Get windows temporary path c#
C# > Files > GetTempPath
GetTempPath retrieves the path of the directory designated for temporary files.
Order to check for the existence of environment variables:
String tempPath = System.IO.Path.GetTempPath();
GetTempPath retrieves the path of the directory designated for temporary files.
Order to check for the existence of environment variables:
- TMP environment variable.
- TEMP environment variable.
- USERPROFILE environment variable.
- Windows directory.
String tempPath = System.IO.Path.GetTempPath();
Etichete:
c#
FRM-40654: Record has been updated by another user
Oracle > dml_data_target_name
FRM-40654: Record has been updated by another user
The case that I had was i changed the query of 1 database block dynamically use set_block_property(’BLOCK1′,Query_Data_Source_Name,’TABLE_X’). This BLOCK1 previously assign to TABLE_A. TABLE_X and TABLE_A has same fields structure.
FRM-40654
As summary, my form blocks condition were like this :
BLOCK1 = TABLE_A
Solution:
use set_block_property on pre_query trigger to change the query_data_source_name to TABLE_X.
Everything looks fine when i load the form, but when i tried to change the field value, it gave me this form error FRM-40654. I search around in Google and only can found several peoples face the same frm-40654 but in different situation.
set_block_property(’BLOCK1′,dml_data_target_name,’TABLE_X’)
FRM-40654: Record has been updated by another user
The case that I had was i changed the query of 1 database block dynamically use set_block_property(’BLOCK1′,Query_Data_Source_Name,’TABLE_X’). This BLOCK1 previously assign to TABLE_A. TABLE_X and TABLE_A has same fields structure.
FRM-40654
As summary, my form blocks condition were like this :
BLOCK1 = TABLE_A
Solution:
use set_block_property on pre_query trigger to change the query_data_source_name to TABLE_X.
Everything looks fine when i load the form, but when i tried to change the field value, it gave me this form error FRM-40654. I search around in Google and only can found several peoples face the same frm-40654 but in different situation.
set_block_property(’BLOCK1′,dml_data_target_name,’TABLE_X’)
Etichete:
Oracle/PLSQL
Subscribe to:
Posts (Atom)