我已将数据表存储在索引0处,而int存储在List中的索引1处,现在我想将列表索引0转换为数据表..它将如何转换为数据表?
//Class Function
public List<object> Login(string A, string B)
{
DataTable dt = new DataTable();
xConn.Open();
SqlCommand xComm = new SqlCommand("Ulogin");
xComm.CommandType = CommandType.StoredProcedure;
xComm.Connection = xConn;
xComm.Parameters.AddWithValue("@Email", A);
xComm.Parameters.AddWithValue("@Pass", B);
int usercount = (Int32)xComm.ExecuteScalar();
xComm.ExecuteNonQuery();
new SqlDataAdapter(xComm).Fill(dt);
List<object> L = new List<object>();
L.Add(dt);
L.Add(usercount);
return L;
}
//Web Form
protected void Sub_Click(object sender, EventArgs e)
{
string Email = TextBox3.Text;
string Pass = TextBox4.Text;
List<object> L = d.Login(Email,Pass);
int I = Convert.ToInt32(L[1]);
if (I > 0)
{
//How does it convert here?
}
else
{
Response.Write("Incorrect Email Or Password");
}
}
答案 0 :(得分:1)