无法打开物理文件操作系统错误32 [英] Unable to open the physical file Operating system error 32

查看:446
本文介绍了无法打开物理文件操作系统错误32的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,这我没了下文取得错误,没有一个线索,为什么数据库连接失败。

Well this i did the below to get the error, don't have a clue why the database connection fails.


  1. 创建一个新的ASP.NET网站

  1. Create a new ASP.NET Website

一个新的* .MDF数据库添加到App_Data文件

Add a new *.mdf database to App_Data

一些表添加到其使用Visual Studio的服务器资源管理器

Add some tables to it using Server Explorer in Visual Studio

右键单击数据库,并复制连接字符串。将其插入WebConfig文件中像下面

Right click DataBase and Copy Connection string. Insert it into WebConfig File like below

<connectionStrings>
    <add name="DB" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\inetpub\wwwroot\gs\App_Data\db.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
</connectionStrings>


  • 添加一些code从

  • Add some code to get the data from

    selectStatement = "select * from users";
    SqlDataAdapter da = new SqlDataAdapter(selectStatement,
    ConfigurationManager.ConnectionStrings["DB"].ConnectionString);
    DataTable dtUsers = new DataTable();
    da.Fill(dtUsers);
    GridView1.DataSource = dtUsers.DefaultView;
    GridView1.DataBind();
    


  • 和阻特你的错误

    推荐答案

    我有一个鬼鬼祟祟的怀疑它做的权限。充分控制你的身份验证的用户。

    I have a sneaky suspicion it has to do with permissions. Give full control to your "Authenticated Users".

    在如果你想知道如何做到这一点---我对Windows 7和步骤是这样的:

    In case you are wondering how to do this --- I am on Windows 7 and the steps go like this:


    • 在MDF文件上单击右键,然后单击属性。

    • 选择安全选项卡,选择你的身份验证的用户(或
      一些看起来右)。

    • 单击编辑,然后选择允许复选框为完全控制。

    • 确定所有的出路。

    心连心

    这篇关于无法打开物理文件操作系统错误32的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆