系统找不到指定的文件。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ComponentModel.Win32Exception: 系统找不到指定的文件。
源错误:
行 79: string strconn = "data source=DESKTOP-JAUDH78\\QWERT;initial catalog=program;uid=sa;pwd=123456";
行 80: SqlConnection conn = new SqlConnection(strconn);
行 81: conn.Open();
行 82:
行 83: SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
源文件: C:\Users\GT\Desktop\ASP.NET\AttendanceSystem\DAL\ConnHelper.cs 行: 81
堆栈跟踪:
[Win32Exception (0x80004005): 系统找不到指定的文件。]
9 个解决方案
#1
同样的代码用窗体写的三层架构就能连接上
-》不要这样讲,或许你照搬代码的时候遗漏了什么呢。
源文件: C:\Users\GT\Desktop\ASP.NET\AttendanceSystem\DAL\ConnHelper.cs 行: 81
-》看文件81行是代码操作,检查错误。
-》不要这样讲,或许你照搬代码的时候遗漏了什么呢。
源文件: C:\Users\GT\Desktop\ASP.NET\AttendanceSystem\DAL\ConnHelper.cs 行: 81
-》看文件81行是代码操作,检查错误。
#2
看错误已经很明显了。
#3
系统找不到指定的文件。
#5
没错啊,DAL层这样写的 public static DataTable getdt(string strSQL)
{
string connectionString = ConfigurationManager.ConnectionStrings["myconn"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
DataTable dt = new DataTable();
da.Fill(dt);
conn.Close();
return dt;
}
web.config里面是这样写的<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="myconn" connectionString="Data Source=DESKTOP-JAUDH78\\QWERT;Initial Catalog=program;uid=sa;pwd=123456;"/>
</connectionStrings>
</configuration>
{
string connectionString = ConfigurationManager.ConnectionStrings["myconn"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
DataTable dt = new DataTable();
da.Fill(dt);
conn.Close();
return dt;
}
web.config里面是这样写的<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="myconn" connectionString="Data Source=DESKTOP-JAUDH78\\QWERT;Initial Catalog=program;uid=sa;pwd=123456;"/>
</connectionStrings>
</configuration>
#6
没错啊,DAL层这样写的 public static DataTable getdt(string strSQL)
{
string connectionString = ConfigurationManager.ConnectionStrings["myconn"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
DataTable dt = new DataTable();
da.Fill(dt);
conn.Close();
return dt;
}
web.config里面是这样写的<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="myconn" connectionString="Data Source=DESKTOP-JAUDH78\\QWERT;Initial Catalog=program;uid=sa;pwd=123456;"/>
</connectionStrings>
</configuration>
{
string connectionString = ConfigurationManager.ConnectionStrings["myconn"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
DataTable dt = new DataTable();
da.Fill(dt);
conn.Close();
return dt;
}
web.config里面是这样写的<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="myconn" connectionString="Data Source=DESKTOP-JAUDH78\\QWERT;Initial Catalog=program;uid=sa;pwd=123456;"/>
</connectionStrings>
</configuration>
#7
--web.config--
<?xml version="1.0"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<customErrors mode="On" defaultRedirect="~/error.htm">
<error statusCode="403" redirect="~/error.htm" />
<error statusCode="404" redirect="~/error.htm" />
<error statusCode="500" redirect="~/error.htm"/>
</customErrors>
</system.web>
<connectionStrings>
<add name="connStr" connectionString="Data Source=192.168.10.36;Initial Catalog=newssystem;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
<?xml version="1.0"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<customErrors mode="On" defaultRedirect="~/error.htm">
<error statusCode="403" redirect="~/error.htm" />
<error statusCode="404" redirect="~/error.htm" />
<error statusCode="500" redirect="~/error.htm"/>
</customErrors>
</system.web>
<connectionStrings>
<add name="connStr" connectionString="Data Source=192.168.10.36;Initial Catalog=newssystem;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
#8
#9
基本上都是这样设置的
#1
同样的代码用窗体写的三层架构就能连接上
-》不要这样讲,或许你照搬代码的时候遗漏了什么呢。
源文件: C:\Users\GT\Desktop\ASP.NET\AttendanceSystem\DAL\ConnHelper.cs 行: 81
-》看文件81行是代码操作,检查错误。
-》不要这样讲,或许你照搬代码的时候遗漏了什么呢。
源文件: C:\Users\GT\Desktop\ASP.NET\AttendanceSystem\DAL\ConnHelper.cs 行: 81
-》看文件81行是代码操作,检查错误。
#2
看错误已经很明显了。
#3
系统找不到指定的文件。
#4
#5
没错啊,DAL层这样写的 public static DataTable getdt(string strSQL)
{
string connectionString = ConfigurationManager.ConnectionStrings["myconn"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
DataTable dt = new DataTable();
da.Fill(dt);
conn.Close();
return dt;
}
web.config里面是这样写的<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="myconn" connectionString="Data Source=DESKTOP-JAUDH78\\QWERT;Initial Catalog=program;uid=sa;pwd=123456;"/>
</connectionStrings>
</configuration>
{
string connectionString = ConfigurationManager.ConnectionStrings["myconn"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
DataTable dt = new DataTable();
da.Fill(dt);
conn.Close();
return dt;
}
web.config里面是这样写的<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="myconn" connectionString="Data Source=DESKTOP-JAUDH78\\QWERT;Initial Catalog=program;uid=sa;pwd=123456;"/>
</connectionStrings>
</configuration>
#6
没错啊,DAL层这样写的 public static DataTable getdt(string strSQL)
{
string connectionString = ConfigurationManager.ConnectionStrings["myconn"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
DataTable dt = new DataTable();
da.Fill(dt);
conn.Close();
return dt;
}
web.config里面是这样写的<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="myconn" connectionString="Data Source=DESKTOP-JAUDH78\\QWERT;Initial Catalog=program;uid=sa;pwd=123456;"/>
</connectionStrings>
</configuration>
{
string connectionString = ConfigurationManager.ConnectionStrings["myconn"].ConnectionString;
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(strSQL, conn);
DataTable dt = new DataTable();
da.Fill(dt);
conn.Close();
return dt;
}
web.config里面是这样写的<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="myconn" connectionString="Data Source=DESKTOP-JAUDH78\\QWERT;Initial Catalog=program;uid=sa;pwd=123456;"/>
</connectionStrings>
</configuration>
#7
--web.config--
<?xml version="1.0"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<customErrors mode="On" defaultRedirect="~/error.htm">
<error statusCode="403" redirect="~/error.htm" />
<error statusCode="404" redirect="~/error.htm" />
<error statusCode="500" redirect="~/error.htm"/>
</customErrors>
</system.web>
<connectionStrings>
<add name="connStr" connectionString="Data Source=192.168.10.36;Initial Catalog=newssystem;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
<?xml version="1.0"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<customErrors mode="On" defaultRedirect="~/error.htm">
<error statusCode="403" redirect="~/error.htm" />
<error statusCode="404" redirect="~/error.htm" />
<error statusCode="500" redirect="~/error.htm"/>
</customErrors>
</system.web>
<connectionStrings>
<add name="connStr" connectionString="Data Source=192.168.10.36;Initial Catalog=newssystem;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
#8
#9
基本上都是这样设置的