How to judge whether Microsoft Text Driver Exist programmatically?

  • Thread starter Thread starter idiot
  • Start date Start date
text driver for what? for data?

Maybe you could just
- create an OleDbConnection
- call Open() on that connection
- surround those calls with a try...catch

-Dino
 
Thank you reply.
How can I get the version of Microsoft Text Driver? Is it same to the
version of ODBCJT32.dll?
 
¤ Thank you reply.
¤ How can I get the version of Microsoft Text Driver? Is it same to the
¤ version of ODBCJT32.dll?
¤

The Text driver is mstext40.dll if you are using Jet 4.0. It's in the Windows System or System32
folder depending upon the version of Windows you are using. You can use the Registry library to
retrieve the path:

Dim Key As Microsoft.Win32.RegistryKey

Try
'Open the registry key.
Key =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Jet\4.0\Engines\Text", True)
If Key Is Nothing Then 'if the key doesn't exist
Throw New Exception("The registry key doesn't exist")
End If

'Get the value.
Dim TextDriverPath As String
TextDriverPath = Key.GetValue("Win32")

Console.WriteLine("Value:{0} for {1} has been successfully retrieved.", TextDriverPath,
"Win32")
Catch e As Exception
Console.WriteLine("Error occurred reading registry" & e.Message)
End Try

You can go one step further and use the System.IO.Directory class (Exists method) to see if the file
is actually present.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top