SqlWindows 6.1 OLEDB to SqlServer

Discussion regarding installation problems for all products.

SqlWindows 6.1 OLEDB to SqlServer

Postby rleffew » Thu Nov 29, 2012 5:56 am

I have installed SqlWindows 6.1 SP2 on Windows 7. I have SS 2008RE2 on my local machine. Trying to connect using OLEDB.

I have created a UDL file, contents of which are:

[oledb]
; Everything after this line is an OLE DB initstring
Provider=SQLOLEDB.1;Password=123456;Persist Security Info=True;User ID=sa;Initial Catalog=SRDB;Data Source=GCRDEV-7PRO\SRHOMES

Two code snippets:

Code: Select all
Set SqlUDL = 'test.udl'
If SqlConnect(hSql)
   Call SalMessageBox('OK','Connected',  MB_Ok)


This one connects -- it works!

However, what I would like to do is put all of that in the code, so this snippet:

Code: Select all
Set SqlUDL = 'Provider=SQLOLEDB.1;Password=123456;Persist Security Info=True;User ID=sa;Initial Catalog=SRDB;Data Source=GCRDEV-7PRO\SRHOMES'
If SqlConnect(hSql)
   Call SalMessageBox('OK','Connected',  MB_Ok)
Else
   Call SalMessageBox('Bummer','ERROR', MB_Ok)


Does NOT work -- it returns: SQL Error: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

I'm probably doing something stupid, any advise is appreciated.

Thanks,

Roy.
rleffew
 
Posts: 8
Joined: Tue Aug 05, 2008 1:52 pm

Re: SqlWindows 6.1 OLEDB to SqlServer

Postby UVS » Tue Dec 04, 2012 12:37 pm

I use:
Set SqlUDL = 'Provider=SQLOLEDB;Data Source=' || strGlobalLocalServer || ';Initial Catalog=' || strServerName || ';Integrated Security=SSPI'

Works fine for me. Also take a look at the string after you have created it and make sure it reads correctly.
UVS
 
Posts: 149
Joined: Thu Jul 03, 2008 8:08 am

Re: SqlWindows 6.1 OLEDB to SqlServer

Postby lrcuess » Tue Dec 04, 2012 11:49 pm

Hello,

your connection string contins a backslash character in the data source: "GCRDEV-7PRO\SRHOMES"
Ensure that you quote that: "GCRDEV-7PRO\\SRHOMES"

Max
Markus Eßmayr
RACON Software GmbH
http://www.racon.at
User avatar
lrcuess
 
Posts: 1163
Joined: Mon May 07, 2007 5:58 am
Location: Linz, Austria

Re: SqlWindows 6.1 OLEDB to SqlServer

Postby rleffew » Wed Dec 05, 2012 5:52 am

Thanks Max!

I knew I had to be doing something "stupid". Trying to save time in testing, I keyed in the whole string forgetting about the special character backslash! :oops:

Roy.
rleffew
 
Posts: 8
Joined: Tue Aug 05, 2008 1:52 pm

Re: SqlWindows 6.1 OLEDB to SqlServer

Postby lrcuess » Thu Dec 06, 2012 5:01 am

No problem!
I think that already happened to everybody of us.
Sometimes it just need's another pair of eyes to "see"! :)

Max
Markus Eßmayr
RACON Software GmbH
http://www.racon.at
User avatar
lrcuess
 
Posts: 1163
Joined: Mon May 07, 2007 5:58 am
Location: Linz, Austria


Return to Installation

Who is online

Users browsing this forum: No registered users and 2 guests

cron