SaveAs ODBC without a DSN??

E

Enlai Pensado

I need to save a project into a SQL Server but both
Application.FileSaveAs and Project.SaveAs must use a DSN.
There's a Microsoft Access DB file type but there's no Microsoft SQL
Server, so we must use an ODBC saving, but in order to avoid multiple
installation of DSN, we're looking for a way to include something in our
code, because our programs knows the server, database, user and pw to use.
So is there another kind of solution than check/create/use a DSN in
order to solve this??
 
E

Enlai Pensado

Enlai Pensado escribió:
I need to save a project into a SQL Server but both
Application.FileSaveAs and Project.SaveAs must use a DSN.
There's a Microsoft Access DB file type but there's no Microsoft SQL
Server, so we must use an ODBC saving, but in order to avoid multiple
installation of DSN, we're looking for a way to include something in our
code, because our programs knows the server, database, user and pw to use.
So is there another kind of solution than check/create/use a DSN in
order to solve this??

Upgrading my code i'm closer to solve it, because now we have a way to
use all the parameters of the driver.

Sub ToOpen()
FileOpen Name:="<{SQL Server};Driver=SQL Server;" & _
"Server=MYSVR;Database=DB1;UID=user;PWD=pwd;" & _
"WSID=APC;APP=" & Application.Name & _
";Language=English>\TST01012005", _
ReadOnly:=False, _
UserId:="user", DatabasePassword:="pwd", _
FormatID:="MSProject.ODBC"
End Sub

Sub ToSave()
FileSaveAs Name:="<{SQL Server};Driver=SQL Server;"; & _
"Server=MYSVR;Database=DB1;UID=user;PWD=pwd;" & _
"WSID=APC;APP=" & Application.Name & _
";Language=English>\TST01012005", _
UserId:="prjuser", DatabasePassWord:="g35tion", _
FormatID:="MSProject.ODBC"
End Sub

But there'are still some bugging items.
When we both open or save a project we must show a "SQL Server Log in"
dialog that hurts a lot because user must click in "Ok" or the rest of
the program fails.

Any idea about how to avoid it?
 
E

Enlai Pensado

Ed Morrison escribió:
Are you trying to save to Project Server?
No, i'm trying to save into a SQL Server database because we use the
project info with another systems.
 
E

Enlai Pensado

Christoph:
Das half mir, den Weg zu finden!
Danke so viel

This is my solving code.

Dim strConnect As String
Alerts False
strConnect = "<{SQL Server};Driver=SQL Server;" & _
"Server=MySVR;Database=MyDB;" & _
"Trusted_Connection=No>\MyProjID"
If FileOpen(Name:=strConnect, ReadOnly:=False, NoAuto:=True, _
UserId:="MyUser", DatabasePassWord:="*****", _
FormatID:="MSProject.ODBC") Then
FileSaveAs Name:=strConnect, UserId:="MyUser", _
DatabasePassWord:="*****", FormatID:="MSProject.ODBC"
FileClose pjDoNotSave
End If


Christoph Bayer escribió:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top