単一の値の場合と同様に、簡単に処理できます。 簡単に一つの変数に値を示すデータベースデータベースからジェネリックハンドラまたはjqueryでデータセットを取得するにはどうすればいいですか?
string i = "";
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SelectPass";
cmd.Parameters.AddWithValue("@userID", context.Request.QueryString["id"]);
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
i = reader["Password"].ToString();
}
reader.Close();
conn.Close();
if (i == "")
{ context.Response.Write("False"); }
else
{
context.Response.Write(i);
}
から、クライアント側で単一の値を取得するように。
function abc()
{
$.get('\HandlerResetPass.ashx?id=' + $('#txtUserId').val()+'&lbl='+ $('#lblPasswo').val(), callback);
function callback(data)
{
if (data == "False")
{
alert('ID doesn\'t exist try again..!')
return false;
}
else
{
$('#tblPassWord').show();
$('#tblprofile').hide();
role = data;
}
}
}
しかし、どのようにAデータセットで作業しますか。
私はちょうど私がこのIDに対してどのように全体のプロファイルを取得しているか知りたいと思っています。どのようにcontext.Response.Write(datatable);どうやって? – QasimRamzan
あなたはあなたが望む情報を持っていれば、答えをaccpetedとしてマークするのを忘れてしまいます。 –