开发者

Visual Studio causes error in SQL Management Studio

This is my first try of Visual Basic 2010 Express, though I have 10 yrs+ experience in VBA.

I'm running Windows XP SP2 on a desktop pc with following installed:

  • Visual Basic 2010 Express... just installed!
  • SQL Server 205 Express ... been running on pc for 12 months

I've created a new DB in SQL for my test application, but have not added any users or permissions to it as I'm using Windows authentication.

I've created a new Windows Forms Solution in VB2010EXP and tried adding a new Data Source for my new SQL DB, but it keeps giving error message about not having rights ot the db.

2 days of searching on the web has confirmed many others with similar issues, but no obvious solution. Eventually I find a few threads about permissions and moving the mdf into the root of the HDD, so try moving my mdf file up closer to the root of the Hard Drive

msf was in C:\Documents and Settings\_SharedData\Application_Data\MSSQL2005\Data\ now in C:\SQL2005\Data\

Now I can finally add a data source to my D开发者_如何学编程b and start to use VS.

Problem is now occasionally when I am workng in VB and then go to the SQL Management Studio and try and view/change my DB, it gives an error and I cant access my DB. I then have to detach and re attach to my DB before I can work on it.

So my questions are:

  1. Surely the location of my MDF file should not be critical???

  2. Do I need to add a user and permission to my DB or should VB be able to deal with this automatically as I'm using windows authentication

  3. Are then any known issues with VB/VS causing errors in SQL Managment Studio?

Thanks in advance

Grant


  1. SQL Server runs on a different Windows Account to the one you use. You can check this by going to services (Run > Services.msc) and under SQL Server, go to properties and the Log On tab. I think by default 2005 uses the 'Network Service' system account. Now the reason you can't attach an MDF sat inside your documents folder is that account doesn't have access to your documents. You could give it permission, but you're much better off having the databases closer to the root as you have done.

  2. Your connection to the database is driven by the connection strings you use. My personal preference is to create SQL Login accounts for my applications, and give them the least possible permissions they require. You could do the same using a Windows Account if you prefer.

  3. I'm sure there are a couple. What is the error you are getting that prevents you accessing the Db? If we can see this error we may be able to help better.

Hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜