Connecting to database in vc 7

I am using _ConnectionPtr componant to connect to Sql server database

i am using the code i get from msdn

its something like as follows

_ConnectionPtr ConnectionPtr1 = NULL;
if ( FAILED ( ::CoInitialize ( NULL ))) return false;
ConnectionPtr1.CreateInstance ( __uuidof(Connection));
ConnectionPtr1 -> ConnectionString = "driver={SQL Server};server='130.1.16.199';user id='sa';password='';";
// driver={SQL Server}; server='local'; user id='sa'; password=''
ConnectionPtr1 -> Open ( "","","",adConnectUnspecified );
ConnectionPtr1 -> DefaultDatabase = " TB_DIALER";
// Display the provider
TRACE ( "\n\nConnection1 provider: %s \n\n",( LPCSTR )ConnectionPtr1 -> Provider );

but i am getting exception here
its saying that sql server not exist or access denied

my sql server is running perfect and i can access it from other vb applications

its very urgent i am actualy stucked here
can any one help me in this
[1120 byte] By [Vinod S] at [2007-11-19 7:31:18]
# 1 Re: Connecting to database in vc 7
I don't know for sure if this is your problem, since I haven't used VC7 with SQL Server, but I notice in your connection string you have:
ConnectionPtr1 -> ConnectionString = "driver={SQL Server};server='130.1.16.199';user id='sa';password='';";

It appears that for password you may have used the wrong " marks? perhaps that should be

ConnectionPtr1 -> ConnectionString = "driver={SQL Server};server='130.1.16.199';user id='sa';password=';'";

That's just a guess at this point, but maybe it'll help point you in the right direction.
krmed at 2007-11-11 0:27:14 >