Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / October 2007



Tip: Looking for answers? Try searching our database.

Using SQL Server 2005 Express from Visual Basic 6

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Norm Nordic - 05 Oct 2007 14:59 GMT
Using this connection string from Vb.net 2005 runs successfully:
"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Program
Files\SQLTest\Database1.mdf;Integrated Security=True;User Instance=True"

I have gone to a previous application written in VB 6 to replace Jet/ACCESS
database files with SQL Express 2005 files. I have tried 2 suggested  
connection strings to the same database file illustrated above without
success.

cn.ConnectionString = "Provider=SQLNCLI.1;Integrated Security=SSPI;" & _
       "Persist Security Info=False;" & _
       "AttachDBFileName= C:\Program Files\SQLTest\Database1.mdf;Data
Source=.\SQLEXPRESS"

                                            and
cn.ConnectionString  =
"Provider=SQLNCLI;Server=.\SQLExpress;AttachDbFilename=C:\Program
Files\SQLTest\Database1.mdf;Trusted_Connection=Yes;"

Both attempts show the following error message:
"CREATE DATABASE permission denied in database 'master'

Thanks in advance.
Sue Severson - 16 Oct 2007 19:52 GMT
I wondered if you have solved this problem.  I am also trying to connect
to SQL Server Express from VB6 - replacing an Access backend with
Express.  

I got this to work on the local machine:
myDB.ConnectionString = "Provider=SQLNCLI;Server=.\SQLEXPRESS;Database="
& gsDatabase & ";Trusted_Connection=yes;AttachDBFilename=" &
gstrDataPath & conBackEndServer & ";"

But when I try to connect over a network, I can't get it to work.  So I
added a user name and try to connect with that on the local machine.  I
get an error: "Create database permission denied in database 'master'.

This is my new connection string:
myDB.ConnectionString = "Provider=SQLNCLI;Server=.\SQLEXPRESS;Database="
& gsDatabase & ";AttachDBFilename=" & gstrDataPath & conBackEndServer &
";Initial Catalog=" & conBackEndServerMDB & ";User Id=" & gSqlUser &
";pwd=" & gconPassword & ";"
Would appreciate any help with this.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.