Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 mdb command line query

Author  Topic 

pithhelmet
Posting Yak Master

183 Posts

Posted - 2009-07-04 : 20:48:16
Hi everyone,

Kinda a different question...

We deploy an access database with our application, but not the whole version of access.

I need to perform a query (update) from the command line against the mdb database.

is there anyway to accomplish this?

thanks
tony

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2009-07-05 : 20:54:56
You'll need to use ODBC.

I would write a short bit of VBScript to create a connection to the MDB and then execute the query using an ADO Command.

You don't need Access installed for this; you just need the data access components that must be there anyway if your app uses Access.

Hope this helps,

Tim
Go to Top of Page

pithhelmet
Posting Yak Master

183 Posts

Posted - 2009-07-06 : 07:27:26
Hi Tim

Thanks for posting.

I do not know the 1st thing about vbscript...

Would you possibly have a short template that simply updates the value of a field in a table.

I can, of course, insert the specific code to complete my needed tasks.

Thanks again

take care
tony
Go to Top of Page

pithhelmet
Posting Yak Master

183 Posts

Posted - 2009-07-06 : 07:33:41
I did a quick google search on vbscript....

I am confused on what IDE/enviroment you would use to execute this vbscript code from within...

i do not have any tools on the laptop other than ODBC and the MDB loaded on them.

can this be accomplished within a batch file?

sorry for the newbie questions.

take care
tony
Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2009-07-06 : 21:29:37
Tony,

You should be able to run VBScript using Windows Scripting Host (WSH) that should be installed by default in Windows.

Just create the script, save it as a .vbs file and then execute it (by double-clicking). The script would look something like this:

Dim cn

Set cn = CreateObject("ADODB.Connection")
cn.Open <your connection string>
cn.Execute <your sql statement>
cn.Close

Go to Top of Page

pithhelmet
Posting Yak Master

183 Posts

Posted - 2009-07-07 : 09:47:46
rock on!!!

I'll try it in a few moments

thanks
tony
Go to Top of Page
   

- Advertisement -