タイプまたは名前空間名「SqlConnection」が見つかりません(using命令またはプログラムセット参照が見つかりませんか?)
「/onlineMovies」アプリケーションのサーバーエラー。
コンパイルエラー
説明:このリクエストにサービスを提供するために必要なリソースをコンパイル中にエラーが発生しました.次の特定のエラーの詳細を確認し、ソースコードを適切に変更してください.コンパイラエラーメッセージ:CS 0246:ソースエラー:
29: {
30: string str = "select top 8 * from Movies order by MovieHit desc";
31: SqlConnection con = DB.getConnection();
32: DataSet ds = new DataSet();
33: SqlDataAdapter sda = new SqlDataAdapter(str, con);
ソースファイル:c:/Users/cai/Documents/Visual Studio 2008/WebSites/onlineMovies/UserControls/Top.ascx.cs行:31
詳細なコンパイラ出力を表示します.
F:/Program Files/Microsoft Visual Studio 9.0/Common7/IDE> "C:/Windows/Microsoft.NET/Framework/v3.5/csc.exe" /t:library /utf8output /R:"C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Web.Extensions/3.5.0.0__31bf3856ad364e35/System.Web.Extensions.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Runtime.Serialization/3.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Data.DataSetExtensions/3.5.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll" /R:"C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Web.Mobile/2.0.0.0__b03f5f7f11d50a3a/System.Web.Mobile.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Web.Services/2.0.0.0__b03f5f7f11d50a3a/System.Web.Services.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.ServiceModel.Web/3.5.0.0__31bf3856ad364e35/System.ServiceModel.Web.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.IdentityModel/3.0.0.0__b77a5c561934e089/System.IdentityModel.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.WorkflowServices/3.5.0.0__31bf3856ad364e35/System.WorkflowServices.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.ServiceModel/3.0.0.0__b77a5c561934e089/System.ServiceModel.dll" /R:"C:/Windows/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll" /R:"C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll" /R:"C:/Windows/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll" /R:"C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/onlinemovies/2ca61950/2ba85a69/App_Code.n_lij92u.dll" /R:"C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Xml.Linq/3.5.0.0__b77a5c561934e089/System.Xml.Linq.dll" /out:"C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/onlinemovies/2ca61950/2ba85a69/App_Web_2-xos-to.dll" /debug- /optimize+ /w:4 /nowarn:1659;1699;1701 /warnaserror- "C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/onlinemovies/2ca61950/2ba85a69/App_Web_2-xos-to.0.cs" "C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/onlinemovies/2ca61950/2ba85a69/App_Web_2-xos-to.1.cs" "C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/onlinemovies/2ca61950/2ba85a69/App_Web_2-xos-to.2.cs"
Microsoft(R) .NET Framework 3.5 Microsoft(R) Visual C# 2008 3.5.30729.4926
(C) Microsoft Corporation。 。
c:/Users/cai/Documents/Visual Studio 2008/WebSites/OnlineMovies/UserControls/Top.ascx.cs(31,9): error CS0246: “SqlConnection”( using ?)
c:/Users/cai/Documents/Visual Studio 2008/WebSites/OnlineMovies/UserControls/Top.ascx.cs(33,9): error CS0246: “SqlDataAdapter”( using ?)
c:/Users/cai/Documents/Visual Studio 2008/WebSites/OnlineMovies/UserControls/Top.ascx.cs(33,34): error CS0246: “SqlDataAdapter”( using ?)
c:/Users/cai/Documents/Visual Studio 2008/WebSites/OnlineMovies/UserControls/Top.ascx(10,99): error CS1061: “ASP.usercontrols_top_ascx” “DataList2_ItemCommand” , “ASP.usercontrols_top_ascx” “DataList2_ItemCommand”( using ?)
バージョン情報:Microsoft.NET Frameworkバージョン:2.0.50727.4961;ASP.NETバージョン:2.0.50727.4955
解決方法:
エラー・ページ・バックグラウンド・プログラムに次のネーミング・スペースを追加
using System.Data.SqlClient
29: {
30: string str = "select top 8 * from Movies order by MovieHit desc";
31: SqlConnection con = DB.getConnection();
32: DataSet ds = new DataSet();
33: SqlDataAdapter sda = new SqlDataAdapter(str, con);
F:/Program Files/Microsoft Visual Studio 9.0/Common7/IDE> "C:/Windows/Microsoft.NET/Framework/v3.5/csc.exe" /t:library /utf8output /R:"C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Web.Extensions/3.5.0.0__31bf3856ad364e35/System.Web.Extensions.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Runtime.Serialization/3.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Data.DataSetExtensions/3.5.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll" /R:"C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Web.Mobile/2.0.0.0__b03f5f7f11d50a3a/System.Web.Mobile.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Web.Services/2.0.0.0__b03f5f7f11d50a3a/System.Web.Services.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.ServiceModel.Web/3.5.0.0__31bf3856ad364e35/System.ServiceModel.Web.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.IdentityModel/3.0.0.0__b77a5c561934e089/System.IdentityModel.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.WorkflowServices/3.5.0.0__31bf3856ad364e35/System.WorkflowServices.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.ServiceModel/3.0.0.0__b77a5c561934e089/System.ServiceModel.dll" /R:"C:/Windows/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll" /R:"C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll" /R:"C:/Windows/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll" /R:"C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/onlinemovies/2ca61950/2ba85a69/App_Code.n_lij92u.dll" /R:"C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll" /R:"C:/Windows/assembly/GAC_MSIL/System.Xml.Linq/3.5.0.0__b77a5c561934e089/System.Xml.Linq.dll" /out:"C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/onlinemovies/2ca61950/2ba85a69/App_Web_2-xos-to.dll" /debug- /optimize+ /w:4 /nowarn:1659;1699;1701 /warnaserror- "C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/onlinemovies/2ca61950/2ba85a69/App_Web_2-xos-to.0.cs" "C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/onlinemovies/2ca61950/2ba85a69/App_Web_2-xos-to.1.cs" "C:/Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/onlinemovies/2ca61950/2ba85a69/App_Web_2-xos-to.2.cs"
Microsoft(R) .NET Framework 3.5 Microsoft(R) Visual C# 2008 3.5.30729.4926
(C) Microsoft Corporation。 。
c:/Users/cai/Documents/Visual Studio 2008/WebSites/OnlineMovies/UserControls/Top.ascx.cs(31,9): error CS0246: “SqlConnection”( using ?)
c:/Users/cai/Documents/Visual Studio 2008/WebSites/OnlineMovies/UserControls/Top.ascx.cs(33,9): error CS0246: “SqlDataAdapter”( using ?)
c:/Users/cai/Documents/Visual Studio 2008/WebSites/OnlineMovies/UserControls/Top.ascx.cs(33,34): error CS0246: “SqlDataAdapter”( using ?)
c:/Users/cai/Documents/Visual Studio 2008/WebSites/OnlineMovies/UserControls/Top.ascx(10,99): error CS1061: “ASP.usercontrols_top_ascx” “DataList2_ItemCommand” , “ASP.usercontrols_top_ascx” “DataList2_ItemCommand”( using ?)