用户控件编译错误,找不到原因,请帮忙。
编译错误
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。
编译器错误信息: CS0103: 名称“mycommand”在类或命名空间“jlzx.equipDB”中不存在
源错误:
行 26:
行 27: // Execute the command
行 28: SqlDataAdapter sda = new SqlDataAdapter(mycommand);
行 29: if (myConnection.State==ConnectionState.Closed)
行 30: myConnection.Open();
源文件: E:\dbserver\components\equipDB.cs 行: 28
行 1: using System;
行 2: using System.Collections;
行 3: using System.Configuration;
行 4: using System.Data;
行 5: using System.Data.SqlClient;
行 6:
行 7:
行 8: namespace jlzx {
行 9:
行 10:
行 11: public class equipDB : System.Web.UI.UserControl{
行 12:
行 13: public DataView Getguestview(string code)
行 14: {
行 15:
行 16: // Create Instance of Connection and Command Object
行 17: SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["admin"]);
行 18: SqlCommand myCommand = new SqlCommand("dt_retrunguest", myConnection);
行 19:
行 20: // Mark the Command as a SPROC
行 21: myCommand.CommandType = CommandType.StoredProcedure;
行 22:
行 23: SqlParameter param = new SqlParameter("@code",SqlDbType.Char,2);
行 24: param.Value = code;
行 25: myCommand.Parameters.Add( param );
行 26:
行 27: // Execute the command
行 28: SqlDataAdapter sda = new SqlDataAdapter(mycommand);
行 29: if (myConnection.State==ConnectionState.Closed)
行 30: myConnection.Open();
行 31: DataSet ds=new DataSet();
行 32: sda.Fill(ds,"tb1");
行 33: myConnection.Close();
行 34: DataView result = ds.Tables["tb1"].DefaultView;
行 35:
行 36: // Return the datareader result
行 37: return result;
行 38: }