简体   繁体   中英

Open a file (.mdb file in Access) in VB.NET

I want to open a mdb file through VB.NET

Currently, I use:

retval = shell("explorer.exe " & filename)

where filename includes the path. It should open the mdb file in Microsoft Access.

This works fine on Windows 7 (my system), but when I try it on Windows XP (client machine) it comes up with the file download security warning dialog asking to Open, Save or Cancel. If I click Open it presents the same dialog but now with Save and Cancel only.

I am sure there is a quick and easy way to open a file in its proper program through VB.NET. I know I can open the database using Interop, but I don't want to go down that route.

Thanks

You can use Process.Start to launch a program. Some good examples here: http://www.dotnetperls.com/process-start-vbnet

For example:

System.Diagnostics.Process.Start("database.mdb")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM