Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Attaching to a SQL Database
Message
From
27/02/2008 04:38:14
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01295993
Message ID:
01296752
Views:
13
Looks like a rights issuse to me if everything else is correct. Try attaching from within MStudio and check what you get.
PS: Sometimes a simple connection string typo causes that too, like I forgot to put a semicolon at the end of "trusted_connection=yes". Once I was going nuts for I couldn't see an extra space in string:)
Cetin

>Hi Cetin, tried code but gettig same error.
>I have also reset up database and am getting following error:
>Sql error '08004' Sql Server Error 4060
>Server rejected the connection.
>
>Strange thing is, I can see the database fine from Sql Server Management studio .
>
>Could this be some sort of user or rights thing ?
>
>Regards,
>Gerard
>
>
>
>>>Hi.
>>>I have following commands:
>>>strConn = "Driver=SQL Server;Server=GERARDXP\SQLEXPRESS;" +;
>>> "Database=C:\MYFOLDER\MYDATABASE.MDF;Trusted_connection=yes"
>>>lnHandle = SQLSTRINGCONNECT(strConn)
>>>
>>>I get a -1 returned in lnHandle , but I can browse the table fine in SQL management Studio.
>>>
>>>Anybody any idea of whats wrong?
>>>Regards,
>>>Gerard
>>
>>Gerard,
>>If you'd 'attach' then use AttachDbFilename attribute. ie:
>>
>>strConn = "Driver={SQL Native Client};Server=.\SQLEXPRESS;" +;
>>    "AttachDbFileName=C:\MYFOLDER\MYDATABASE.MDF;Trusted_connection=yes"+;
>>    "Database=yourdatabasenamehere"
>>
>>Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform