Discussion:
SQL Server Express/VB6 Backup
(too old to reply)
l***@glenfieldsoftware.com
2007-03-26 16:32:20 UTC
Permalink
Hi,

I'm looking for a way to automate SQL Server Express backups through
VB6. I thought I could use SQLDMO but it won't even connect to the
database - I get an error saying I need to use SQL Management Objects
but I can't find too much info on these in regard to VB6.

Has anyone done something similar or have code example they could
point me to.

Regards,

Lee Burrett
Glenfield Software.
Max Kudrenko
2007-03-26 16:41:21 UTC
Permalink
Lee,

One way of doing this is via shelling sqlcmd, something like this:

sqlcmd -UX1 -PX2 -SX3 -dX4 -Q"BACKUP DATABASE X4 TO DISK = 'X5'"

See here http://msdn2.microsoft.com/en-us/library/ms170207.aspx for
the information on its parameters.

Hope this helps,

Max Kudrenko
Brainbench MVP Program for Visual Basic
www.brainbench.com
Post by l***@glenfieldsoftware.com
Hi,
I'm looking for a way to automate SQL Server Express backups through
VB6. I thought I could use SQLDMO but it won't even connect to the
database - I get an error saying I need to use SQL Management Objects
but I can't find too much info on these in regard to VB6.
Has anyone done something similar or have code example they could
point me to.
Regards,
Lee Burrett
Glenfield Software.
l***@glenfieldsoftware.com
2007-03-26 16:44:41 UTC
Permalink
Post by Max Kudrenko
Lee,
sqlcmd -UX1 -PX2 -SX3 -dX4 -Q"BACKUP DATABASE X4 TO DISK = 'X5'"
See herehttp://msdn2.microsoft.com/en-us/library/ms170207.aspxfor
the information on its parameters.
Hope this helps,
Max Kudrenko
Brainbench MVP Program for Visual Basicwww.brainbench.com
Post by l***@glenfieldsoftware.com
Hi,
I'm looking for a way to automate SQL Server Express backups through
VB6. I thought I could use SQLDMO but it won't even connect to the
database - I get an error saying I need to use SQL Management Objects
but I can't find too much info on these in regard to VB6.
Has anyone done something similar or have code example they could
point me to.
Regards,
Lee Burrett
Glenfield Software.- Hide quoted text -
- Show quoted text -
Max,

That's sort of how I do it now - just wondered whether there was a
more integrated way within VB using something like SQLDMO?

Regards,

Lee.
Max Kudrenko
2007-03-26 16:54:42 UTC
Permalink
I don't know if there's a "more integrated" way of doing this but I
actually doubt it would be more reliable. I found that command line
utilities (sqlcmd, bcp) are the best way of doing many DB taks and in
some cases there is just no alternative.
Post by l***@glenfieldsoftware.com
Max,
That's sort of how I do it now - just wondered whether there was a
more integrated way within VB using something like SQLDMO?
Regards,
Lee.
Ken Halter
2007-03-26 21:04:19 UTC
Permalink
Post by l***@glenfieldsoftware.com
Max,
That's sort of how I do it now - just wondered whether there was a
more integrated way within VB using something like SQLDMO?
Regards,
Lee.
fwiw, I use SQLDMO with SQL Express 2005... using these references...

Microsoft ActiveX Data Objects 2.7 Library
Microsoft Data Environment Instance 1.0 (SP4)
Microsoft SQLDMO Object Library
--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm
l***@glenfieldsoftware.com
2007-03-27 08:03:14 UTC
Permalink
On Mar 26, 10:04 pm, "Ken Halter"
Post by Ken Halter
Post by l***@glenfieldsoftware.com
Max,
That's sort of how I do it now - just wondered whether there was a
more integrated way within VB using something like SQLDMO?
Regards,
Lee.
fwiw, I use SQLDMO with SQL Express 2005... using these references...
Microsoft ActiveX Data Objects 2.7 Library
Microsoft Data Environment Instance 1.0 (SP4)
Microsoft SQLDMO Object Library
--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory -http://www.vbsight.com/Remembrance.htm
Ken,

I just keep getting the same message -
To connect to this server you must use SQL Server Management Studio or
SQL Server Management Objects (SMO).

Any chance of a code snippet?

Regards,

Lee.

Continue reading on narkive:
Loading...