static ADOX.DataTypeEnum GetAccessFormats(DataColumn col)
{
switch (col.DataType.Name)
{
case "Boolean":
return ADOX.DataTypeEnum.adBoolean;
case "Byte":
return ADOX.DataTypeEnum.adUnsignedTinyInt;
case "Char":
return ADOX.DataTypeEnum.adVarWChar;
case "DateTime":
return ADOX.DataTypeEnum.adDate;
case "Decimal":
return ADOX.DataTypeEnum.adDecimal;
case "Double":
return ADOX.DataTypeEnum.adDouble;
case "Int16":
return ADOX.DataTypeEnum.adSmallInt;
case "Int32":
return ADOX.DataTypeEnum.adInteger;
case "Int64":
return ADOX.DataTypeEnum.adInteger;
case "SByte":
return ADOX.DataTypeEnum.adUnsignedSmallInt;
case "Single":
return ADOX.DataTypeEnum.adSingle;
case "String":
return ADOX.DataTypeEnum.adVarWChar;
case "TimeStamp":
return ADOX.DataTypeEnum.adGUID;
default:
return ADOX.DataTypeEnum.adUserDefined;
}
}
29 de Abril de 2009
Obter o Sinónimo Access ADOX de uma DataColumn ADO.NET
Publicada por
Joao Livio
em
9:58 PM
0
comentários
Etiquetas: C#, Código Fonte, VSTO
22 de Abril de 2009
VSTO (Access) – Verificar se a Internet está disponível
public bool IsInternetAvailable()
{
try
{
using (System.Net.Sockets.TcpClient clnt =
new System.Net.Sockets.TcpClient("www.microsoft.com", 80))
{
clnt.Close();
}
return true;
}
catch (Exception)
{
throw;
}
}
Publicada por
Joao Livio
em
10:19 PM
0
comentários
Etiquetas: C#, Código Fonte, VSTO
VSTO (Access) - Como tocar um ficheiro WAV?
public string PlayWAVFile(string myPath)
{
try
{
using (SoundPlayer objPlayer = new SoundPlayer { SoundLocation = myPath })
{
objPlayer.Play();
return "Ok";
}
}
catch (Exception)
{
throw;
}
}
Publicada por
Joao Livio
em
10:16 PM
0
comentários
Etiquetas: C#, Código Fonte, VSTO
VSTO (Access) - Como verificar se duas tabelas são iguais?
public bool TablesAreEqual(string MyTableSource, string MyTableToCompare, string MyIndexField)
{Access.Application oAccess = ((Access.Application)
(Marshal.GetActiveObject("Access.Application")));
try
{
OleDbConnection cnn;
using (DataSet ds = new DataSet())
{
OleDbDataAdapter da;
string cs = oAccess.CurrentProject.Connection.ToString();
string strSQL = String.Format("SELECT * FROM {0} LEFT JOIN {1} ON {0}.{2} = {1}.{2}WHERE {1}.{2} Is Null"
, MyTableSource, MyTableToCompare, MyIndexField);
cnn = new OleDbConnection(cs);
da = new OleDbDataAdapter(strSQL, cnn);
da.Fill(ds);
if (ds.Tables[0].Rows.Count <= 0)
return true;
else
return false;
}
}
catch (Exception)
{
throw;
}
finally
{
Marshal.ReleaseComObject(oAccess);
}
}
Publicada por
Joao Livio
em
10:15 PM
0
comentários
VSTO – Como gerar um GUD?
public string GenerateGUID()
{
try
{
Guid guid = Guid.NewGuid();
return guid.ToString();
}
catch (Exception)
{
throw;
}
}
Publicada por
Joao Livio
em
10:14 PM
0
comentários
Etiquetas: C#, Código Fonte, VSTO
VSTO - Como efectuar o backup da Base de Dados Access aberta?
public bool BackupCurrentDatabase(string MyDestinationpathAndFile)
{
Access.Application oAccess = ((Access.Application)
(Marshal.GetActiveObject("Access.Application")));
try
{
File.Copy(oAccess.CurrentProject.FullName, MyDestinationpathAndFile);
return true;
}
catch (Exception)
{
throw;
}
finally
{
Marshal.ReleaseComObject(oAccess);
}
Publicada por
Joao Livio
em
10:11 PM
0
comentários
Etiquetas: C#, Código Fonte, VSTO
Access 2007 Bibliotecas (DLL) no CodePlex
Lancei recentemente o MACL no CodePlex.
O que é o MACL?
É um conjunto de bibliotecas com utilidades e acesso a Dados que tem como objectivo facilitar a vida ao programador VBA. O código fonte foi desenvolvido em C# e utiliza as funcionalidades do Framework 2.0
Requisitos:
Framework 2.0
Access 2007
Compatível com VB 6.0
Onde posso encontrar?
No CodePlex
No Blog com exemplos
No Forum de suporte
A Release
Publicada por
Joao Livio
em
9:46 PM
0
comentários
Etiquetas: Codeplex, MVP, Office 2007, VBA
Windows SharePoint Designer 2007 agora Grátis!
Publicada por
Joao Livio
em
9:35 PM
0
comentários
Etiquetas: Microsoft, Office 2007
14 de Janeiro de 2009
DevDays 2009
Participe no grande evento técnico do ano e aproveite ao máximo a agenda do DevDays!
São 2 dias de conteúdos técnicos avançados, com mais de 50 sessões e 40 laboratórios, onde irá conhecer as mais recentes novidades da tecnologia Microsoft e contactar com reconhecidos especialistas das nossas Comunidades Técnicas.
> 2 dias de conteúdos técnicos avançados
> Mais de 50 sessões e cerca de 40 laboratórios
> Um evento para Programadores, Arquitectos e Designers
Contacte com Especialistas
Partilhe experiências, troque ideias, e aprenda com quem tem desafios semelhantes aos seus.
Inspire-se, divirta-se e mergulhe na Inovação
Encontre as melhores ideias e faça parte deste momento!
Aprenda sobre as mais recentes novidades tecnológicas como o Windows 7, Internet Explorer 8, Windows Azure e aprofunde os seus conhecimentos sobre desenvolvimento, web, design e experiência de utilização.
Venha ao DevDays!
ñ Saiba como o TeamSystem pode melhorar o desempenho da sua Equipa, tornando-a mais produtiva e eficiente
ñ A nova experiência de interacção digital com a Microsoft Surface
ñ Novos modelos de negócio potenciados pelo Windows Azure
ñ Veja como o Windows 7 e o IE8 elimina barreiras entre software, services e dispositivos e trazem ritmo acrescido ao seu dia-a-dia e da sua empresa
ñ Biztalk 2009 com uma solução de RFID muito interessante
ñ Consiga um novo nível de soluções Web com o Silverlight
ñ O potencial da informação geo-referenciada com o SQL Server 2008
Principais Conteúdos Temáticos
> Visual Studio 10 e .Net 4
> Microsoft Surface
> Windows 7 e Internet Explorer 8
> Windows Azure e Azure Services Platform
> Biztalk 2009
> Silverlight e WPF
> SQL Server 2008
> ASP.NET
> Windows Live Services
Participe!
Valor de Inscrição: 100€ (com IVA incluído)
Publicada por
Joao Livio
em
8:46 PM
0
comentários
17 de Dezembro de 2008
Quando se tenta colar dados directamente do Excel 2007 para o Microsoft Access 2007 é gerado erro.
Parece que têm havido alguns problemas com a actualização
Security Update for Microsoft Office Excel 2007 (KB958437).
O resutado é um erro quando se tenta colar dados directamente do Excel 2007 para o Microsoft Access 2007
Os dados na Área de Transferência estão danificados, por isso o Microsoft Access não consegue colá-los. / Pode haver um erro na Área de Transferência ou pode não existir memória suficiente. Tente novamente a operação.
Para já não consigo arranjar nenhuma solução, para resolver o problema desistale esta actualização. Vou dando notícias.
Publicada por
Joao Livio
em
2:25 PM
1 comentários
30 de Outubro de 2008
Reparar Ficheiros Office - Repair Office Files
MDB, DBF, XLS, XLW and DOC Files Recover
PORTUGUÊS
Estou a iniciar testes para reparar ficheiros:
- Access (MBD)
- Dbase e FoxPro (DBF)
- Excel (XLS e XLW)
- Word (DOC)
Vou oferecer as primeiras 3 recuperações de cada Formato
Contacto: livio@live.com.pt
ENGLISH
I am testing to recover files in format:
- Access (MBD)
- Dbase e FoxPro (DBF)
- Excel (XLS e XLW)
- Word (DOC)
I'am going to offer the first 3 Repairs for each format
Contact: livio@live.com.pt
Publicada por
Joao Livio
em
7:13 PM
1 comentários
Etiquetas: MVP, Office, Utilidades e Fix's, Workarounds - Fix
EVENTO: Architect Cloud Computing

Cloud Computing
Um conceito global. Uma nova arquitectura!
O Cloud Computing é um termo simples que representa a abstracção para uma complexidade de padrões, serviços e infra-estrutura. É considerado por muitos, como uma forma escalável, elástica e económica de implementar soluções, representando uma mudança significativa de paradigmas.
Neste contexto, participe neste fórum de Arquitectos
Agenda
09:00
Welcome coffee
09:30
Microsoft's Cloud Computing Platform : What it is and when to use it
Cloud computing looks like the biggest change to hit our industry in many years. The advent of cheap, scalable computing power available over the Internet will affect almost everybody who works in IT. But taking advantage of this shift requires understanding this new approach and how to exploit it.
In this half-day seminar, David Chappell looks at the big picture of cloud computing, then focuses in on Microsoft's new cloud platform technologies.
David Chappell
13:00
Almoço (livre)
14:30 / 18:00
Sessões a desvendar após o PDC (Professional Development Conference)

Architect David Chappell
David Chappell is Principal of Chappell & Associates in San Francisco, California.
Through his speaking, writing, and consulting, he helps software professionals
around the world understand, use, and make better decisions about new
technologies. David has been the keynote speaker for many conferences
and events on five continents, and his seminars have been attended by
tens of thousands of developers, architects, and decision makers in forty
countries. David's books have been translated into ten languages and used
regularly in courses at MIT, ETH Zurich, and other educational institutions.
In his consulting practice, he has helped clients such as Hewlett-Packard,
IBM, Microsoft, Stanford University, and Target Corporation adopt new
technologies, market new products, train their sales staffs, and create business plans.

Publicada por
Joao Livio
em
1:26 PM
0
comentários
Etiquetas: Cursos Formação, Microsoft
28 de Outubro de 2008
capitalizar Frases em cada palavra em SQL Server
Aqui partilho uma simples função que criei e que vai CAPITALIZAR as frases em cada Palavra, ou seja vai colocar uma MAIÚSCULA em cada palavra na primeira letra. não estou a contemplar os "DE", "DAS" Etc..
Nesta função estou a retornar varchar(5000) altera como quiseres.
USE [Menos3ERP]
GO
/****** Object: UserDefinedFunction [dbo].[ProperCase] Script Date: 10/15/2008 23:38:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER function [dbo].[ProperCase](@Text as varchar(5000))
returns varchar(5000)
as
begin
declare @Reset bit;
declare @Ret varchar(5000);
declare @i int;
declare @c char(1);
select @Reset = 1, @i=1, @Ret = ”;
while (@i <= len(@Text))
select @c= substring(@Text,@i,1),
@Ret = @Ret + case when @Reset=1 then UPPER(@c) else LOWER(@c) end,
@Reset = case when @c like ‘[a-zA-Z]‘ then 0 else 1 end,
@i = @i +1
return @Ret
end
Publicada por
Joao Livio
em
10:51 PM
1 comentários
Etiquetas: Artigos, Como fazer, SQL Server
Suportar mais que uma Lingua MDB/ACCDB no Microsoft Access
Nas minhas bases de dados em que dou suporte a mais que uma lingua, costumo correr uma "Função" que nada retorna neste caso mas que te pode ajudar. o que faço é carregar de uma tabela Access onde incluo o NOME DO FORM, O NOME DO CONTROLO e a LINGUA e comparo o Nome do controlo fazendo no form passado na função igual ao valor da tabela, aqui fica a ideia.
Option Compare Database
Public Function yTranslaction(ByVal strFORM As String, _
ByVal frmFORM As Form)
Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim strSQL As String
Dim ctlCONTROL As Control
On Error GoTo erro
strLanguage = “pt-PT”
strSQL = “SELECT * FROM y_TRANSLACTIONS ” & _
“WHERE LANGUAGE =’” & strLanguage & “‘” & ” AND FORM=’” & strFORM & “‘”
cnn.ConnectionString = CurrentProject.Connection
cnn.Open
rs.Open strSQL, cnn, adOpenKeyset, adLockOptimistic
Set frmFORM = Forms(strFORM)
With rs
Debug.Print .RecordCount
Do Until rs.EOF = True
For Each ctlCONTROL In frmFORM.Controls
If TypeOf ctlCONTROL Is Label Then
If ctlCONTROL.Name = rs.Fields(”CONTROL”).Value Then
ctlCONTROL.Caption = rs.Fields(”CAPTION”).Value
End If
End If
If TypeOf ctlCONTROL Is CommandButton Then
If ctlCONTROL.Name = rs.Fields(”CONTROL”).Value Then
ctlCONTROL.Caption = rs.Fields(”CAPTION”).Value
End If
End If
Next
.MoveNext
Loop
End With
cnn.Close
Set rs = Nothing
Exit Function
erro:
MsgBox Err.Number & ” - ” & Err.Description, vbOKOnly + vbExclamation, “Erro na Rotina”
End Function
Publicada por
Joao Livio
em
10:44 PM
0
comentários
Etiquetas: Como fazer, VBA
Carregar Ribbons com ADODB
Um dos problemas nos Projectos ADP em Microsoft access é termos de carregar todas as Ribbons através do Método LoadCustomUI, Preferivelmente temos de o fazer através de uma função. O que podemos fazer é cria uma tabela com o RIBBONNAME e O RIBBONXML em dois campos, como o nome indica o Nome da ribbon e o XML Adjacente.
Aqui fica a Função
Public Function LoadRibbons() As Integer
Dim rst As New ADODB.Recordset
On Error GoTo LoadRibbon_Err
‘ Try to load - open recordset on Ribbons
rst.Open “SELECT * FROM z_MENUS_USysRibbons”, CurrentProject.Connection, _
adOpenKeyset, adLockOptimistic
Do Until rst.EOF
Application.LoadCustomUI rst!RibbonName, rst!RibbonXML
rst.MoveNext
Loop
‘ Close out
rst.Close
Set rst = Nothing
LoadRibbons = True
LoadRibbon_Exit:
Exit Function
LoadRibbon_Err:
LoadRibbons = False
Resume LoadRibbon_Exit
End Function
Publicada por
Joao Livio
em
10:38 PM
0
comentários
Etiquetas: Como fazer, VBA
24 de Outubro de 2008
Office Systems 2007 Service Pack 2
Já estou a testar o service Pack 2 para o Office Systems 2007. O que posso divulgar não é muito, mas aqui fica a informação Oficial e o que vai Mudar/Optimizar/Adicionar
For Office Desktop Programs:
Improved Outlook Calendaring Reliability
Improved Outlook Performance
Enabling Object Model support for Charts in PowerPoint and Word
Improved cryptographic functionality by supporting all cryptographic algorithms offered by the operating system
Improved functionality in Excel’s charting mechanism
Ability to ungroup SmartArt graphics (and as a result, the ability to add animations to them in PowerPoint)
Ability for Visio to export UML models to an XML file compliant with the XMI standard
Tool that enables the uninstall of Office client Service Packs
For Servers:
Performance and manageability improvements to variations in Enterprise Content Management (ECM) including STSADM commands for repairing links between source and target pages
Improvements around processing status approvals from Office Project Web Access into Office Project Professional 2007
Improvements to read-only content databases and index rebuild timer jobs in Windows SharePoint Services 3.0
We’re pleased to announce that Service Pack 2 (SP2) for the 2007 Microsoft Office system is expected to be released in the near future. Although we aren’t yet …
We’re pleased to announce that Service Pack 2 (SP2) for the 2007 Microsoft Office system is expected to be released in the near future. Although we aren’t yet ...
Read More:
http://blogs.technet.com/office_sustained_engineering/archive/
Publicada por
Joao Livio
em
11:41 PM
0
comentários
Utilitários e FIX's para o Office System
Comecei a minha saga de desenvolvimento de ferramentas e utilidades, resolvi começar por 1 FIX e 1 Utilitário, neste caso o FixMRU Beta que vai resolver o problema da espera "desesperante" em arrancar que em alguns casos o Office Picture manager apresenta. Fiz tambem um utilitário que vai pegar num MDB e tentar recuperar as tabelas apagas, vê em baixo. ESPERO QUE SEJA ÚTIL
OffPictManagerFixMRU (Version Beta1)
Feedback is welcome for erros and new features
System Requirements
Windows 2000 SP4/XP (32/64 Bits)
Windows Vista (32/64 Bits)
Office Picture Manger become slow to Open
My Original Article: Here
Download
Download FIX (32/64 Bits): Here
This Fix is provided “AS-IS”. Was created by Joao Livio Microsoft MVP Office, i don’t work At or For Microsoft, please see http://mvp.support.microsoft.com/. Use it at your own Risk
MDBTableRecover (Version 1.0.0.2)
Feedback is welcome for erros and new features
I only support MDB (Office 11) Files in this Version, working and improving Utility
System Requirements
Windows 2000 SP4/XP (32/64 Bits)
Windows Vista (32/64 Bits)
Download
Download Utility (32/64 Bits): Here
This Utility is provided “AS-IS”. Was created by Joao Livio Microsoft MVP Office, i don’t work At or For Microsoft, please see http://mvp.support.microsoft.com/. Use it at your own Risk
Publicada por
Joao Livio
em
11:34 PM
0
comentários
Etiquetas: MVP, Office 2007, Utilidades e Fix's, Workarounds - Fix


