Archive for May 2nd, 2009

Linked Server in SQL SERVER 2005
Saturday, May 02nd, 2009 | Author: admin

Boas a todos. O blog já não é actualizado a algum tempo, ao qual peço desculpa a todos :) mas o tempo disponível tem sido pouco …..
Indo ao assunto deste post :)
Imaginem o seguinte:
Vocês têm dois servidores SQL SERVER, servidor A e B.
Estão no servidor A, mas precisam de fazer uma consulta, por exemplo, a uma tabela que se encontra no servidor B.
Nada mais simples do que criar um linked server. como? Fácil.:)

– cria o link a outro servidor
EXEC sp_addlinkedserver
@server = ‘nome_no_local’, – nome com que o servidor sera conhecido no servidor

@srvproduct = ,
@provider = ‘MSDASQL’,
@provstr = ‘DRIVER={SQL Server};SERVER=nome_do_servidor_B;UID=user_servidor_B;PWD=password_servidor_B;’

– lista o servidor linkado
select * from sys.servers where name=‘nome_no_local’

– selecciona dados no servidor linkado
select * from nome_no_local.nome_basededados.dbo.nome_tabela

– elimina o link ao servidor linkado
exec sp_dropserver ‘nome_no_local’

e pronto :D
Qualquer dúvida ou sugestões é só comentar :)
Abraços

Category: Uncategorized  | Tags: , , ,  | Leave a Comment

If you automate Microsoft Excel with Microsoft Visual Basic .NET, Microsoft Visual C# .NET, or Microsoft Visual C++, you may receive the following error when calling certain methods:

Error: 0×80028018 (-2147647512)
Description: Old Format or Invalid Type Library

CAUSE

You receive this error calling an Excel method when the following conditions are true:

The method requires an LCID (locale identifier).
You run an English version of Excel. However, the regional settings for the computer are configured for a non-English language.

If the client computer runs the English version of Excel and the locale for the current user is configured for a language other than English, Excel will try to locate the language pack for the configured language. If the language pack is not found, the error is reported.

WORKAROUND

To work around this problem, you can use one of the following methods:

Install the Multilingual User Interface Pack for your version of Office.
Execute the Excel method or property by using InvokeMember so that you can specify the CultureInfo for the call. For example, the following code illustrates how you can invoke the Workbooks object Add method with “en-US” as the CultureInfo:

“Dim oApp As New Excel.Application()

oApp.Visible = True

oApp.UserControl = True

Dim oBooks As Object = oApp.Workbooks

Dim ci As System.Globalization.CultureInfo = New System.Globalization.CultureInfo(”en-US”)

oBooks.GetType().InvokeMember(”Add”, Reflection.BindingFlags.InvokeMethod, Nothing, oBooks, Nothing, ci)”

Or, set the CultureInfo prior to calling the Excel method. For example:

“Dim oApp As New Excel.Application()

oApp.Visible = True

oApp.UserControl = True

Dim oldCI As System.Globalization.CultureInfo = _

System.Threading.Thread.CurrentThread.CurrentCulture

System.Threading.Thread.CurrentThread.CurrentCulture = _

New System.Globalization.CultureInfo(”en-US”)

oApp.Workbooks.Add()

System.Threading.Thread.CurrentThread.CurrentCulture = oldCI”


When you use one of these workarounds for a computer where the regional settings do not match the current language version of Office, you should be familiar with how Excel behaves and how Excel will interpret data that might be formatted for a specific locale. For more details about writing globalized Excel solutions with Visual Studio .NET, please see the following articles in the MSDN:

Creating Office Solutions for Use in Multiple Countries/Regions

http://msdn2.microsoft.com/en-us/library/aa168494(office.11).aspx (http://msdn2.microsoft.com/en-us/library/aa168494(office.11).aspx)

Globalization and Localization Issues for Solutions Created with Microsoft Visual Studio Tools for the Microsoft Office System

http://msdn2.microsoft.com/en-us/library/aa192494(office.11).aspx (http://msdn2.microsoft.com/en-us/library/aa192494(office.11).aspx)

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the “Applies to” section.

MORE INFORMATION

Steps to reproduce the behavior

1. Verify that the locale for the computer is set to a language other than English.

For Windows 2000:

a. In Windows Control Panel, double-click Regional Options.
b. On the General tab, select a location, and then click OK.

For Windows XP or Windows Server 2003:

a. In Control Panel, open Regional and Language Options.
b. On the Regional Options tab, select a locale, and then click OK.
2. Start Microsoft Visual Studio .NET.
3. On the File menu, point to New, and then click Project. In the New Project dialog box, under Project Types, click Visual Basic Projects. Under Templates, click Windows Application, and then click OK. By default, Form1 is created.
4. On the View menu, click Toolbox, and then add a button to Form1.
5. To display the code window for the form, double-click Button1.
6. In the code window, replace the following code

Private Sub Button1_Click(ByVal sender As System.Object, _

ByVal e As System.EventArgs) _

Handles Button1.Click

End Sub


with:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim oApp As Object

Dim oDoc As Object

oApp = CreateObject(”Excel.Application”)

oApp.Visible = True

oDoc = oApp.Workbooks.Add

oDoc.Close()

oApp.Quit()

oDoc = Nothing

oApp = Nothing

End Sub

7. Add the following line to the beginning of the Form1 code module:

Option Strict Off

8. Press F5 to build and run the program.
9. To generate the error, click Button1. The error occurs on the line that reads:

oDoc = oApp.Workbooks.Add

SOURCE: http://support.microsoft.com/default.aspx?scid=kb;en-us;320369

Category: Uncategorized  | Tags: , , ,  | Leave a Comment

Erro no Setup Support Rules:
Rule Name
PerfMonCounterNotCorruptedCheck
Rule Description
Checks if existing
performance counter registry hive is consistent.
Message/Corrective Action
The performance counter registry hive is corrupted. To continue, you must
repair the performance counter registry hive. For more information, see
http://support.microsoft.com/kb/300956.
 

 

 

É provavél que já tenham tentado instalar o SQL Server 2008 Express Edition e caso não tenham o windows instalado em inglês ter surgido o erro acima descrito.
Comigo aconteceu :) andei a pesquisar e achei a solução.
Para facilitar a vida, criei uma pequena aplicação que resolve esse erro.
Segue aqui o link:

http://www.speedyshare.com/902763795.html
Entretanto a pedido fiz outra versão da aplicação:
Segue o link para download: http://www.it-improves.com/dnn/Downloads/tabid/60/Default.aspx

NOTA: a responsabilidade de algum dano causado pela aplicação é do utilizador! faça um ponto de restauro no windows antes de executar!! Garanto que é 100% sem spyware, malware,virus e essas coisas todas, apenas mexe no registo do windows o que pode causar danos no pc caso corra alguma coisa errada!

Ao efectuar o download grave no pc, se executar directamente o programa não funcionará correctamente pois fica na pasta dos temporários e não tem permissões para executar.

Para os mais desconfiados e que querem fazer de modo manual ca fica também o processo para corrigir ( são estes os passos que o programa que criei efectua)

Put this at any Console application:
string.Format(”{0,3}”,
CultureInfo.InstalledUICulture.Parent.LCID.ToString(”X”)).Replace(” “, “0″);

Watch the result. At mine it was “016″.

Then you go to the
registry at this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Perflib

and create another one with the name you got
from the string.Format result.
In my case:
“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Perflib\016″

and copy the info that is on any other
key in this Perflib to this key you
just created. Run the instalation again.
Done!

Category: Utilities  | Tags: , , , ,  | 2 Comments
Diferenças entre office 2003 e office 2007
Saturday, May 02nd, 2009 | Author: admin

Já devem ter reparado que as diferenças entre o Office 2003 e o Office 2007 são grandes :) as opniões são várias,
uns a favor outros contra como tudo na vida :)

Aqui fica um link com as diferenças( técnicas) entre os dois. link aqui

Category: Uncategorized  | Tags: , ,  | Leave a Comment

Hi, if you try to compile an app in a network shared folder,or on some hosts.. maybe you will get this error

ERROR:

Could not load file or assembly ‘Microsoft.Practices.EnterpriseLibrary.Configuration.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0×80131417)

This error occurs because the default trust level for local machine is Full trust, but in the network share not.

So to compile your applications remotely you have to:

1. Go to Control Panel -> Adiministrative Tools -> Microsoft .NET Framework 2.0 Configuration

2. Open My Computer -> Runtime Security Policy -> Machine -> Code Groups -> All Code ->New

the URL field in the next figure is the path to the shared folder , in this case, but you can choose Strong Names( for .exe or .dll) etc


 

 

 

 

 

 

 

 

 

 

Click Finish and you can compile your app!!
I hope this article help you…

Welcome
Saturday, May 02nd, 2009 | Author: admin

Welcome to the new it-improves blog.

Whit this blog we want to share with you articles to help you, to help everyone to improve the world