まあ、CS0103 C# 'Json'という名前は現在のコンテキストに存在しません
私はJsonResult関数を書いています。しかし、私は次のエラーが表示されます:
CS0103 C# The name 'Json' does not exist in the current context
私は解決策を見つけることができません... plzzヘルプ?
public JsonResult DoUserExist(string Emailaddress)
{
bool ch = false;
string connectionString = ConfigurationManager.ConnectionStrings["FreelanceDBCS"].ConnectionString;
using (SqlConnection con = new SqlConnection(connectionString))
{
SqlCommand cmd = new SqlCommand("GetCities", con);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr != null)
{
ch = true;
}
}
return Json(ch,JsonRequestBehavior.AllowGet);
}
あなたのリターンオブジェクトは、関数の戻り値の型と同じになるようにニーズを必要とします:
私は
パブリッククラスユーザーコントローラクラスから私のクラスを派生するために忘れてしまいました。 – DinoMyte
model-view-controllerタグは、パターンに関する質問用です。 ASP.NET-MVCの実装には特定のタグがあります。 –