源错误:
行 35: SqlDataAdapter da = new SqlDataAdapter(str, conn);
行 36: DataSet ds = new DataSet();
行 37: da.Fill(ds, "score");
行 38: DataGrid1.DataSource = ds;
行 39: DataGrid1.DataBind();
源文件: e:\kechen\tcmg.aspx.cs 行: 37
string strcon = "data source=www-51f7b2a9835\\sqlexpress;initial catalog=student;integrated security=SSPI";
SqlConnection conn = new SqlConnection(strcon);
conn.Open();
string sel="select * from teacher where t_no='"+TextBox2 .Text .ToString ().Trim ()+"'and t_pas ='"+TextBox1 .Text.ToString ().Trim () +"'";
SqlCommand cmd = new SqlCommand(sel, conn);
SqlDataReader read = cmd.ExecuteReader();
conn.Close();
if (read.Read())
{
LinkButton1.Visible = true;
LinkButton2.Visible = true;
string str = "SELECT score.c_no, sco.s_no, sco.score FROM score INNER JOIN sco ON score.c_no = sco.c_no";
SqlDataAdapter da = new SqlDataAdapter(str, conn);
DataSet ds = new DataSet();
da.Fill(ds, "score");
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
}
else
{
Label1.Text = "帐号或密码有错误";
}
行 35: SqlDataAdapter da = new SqlDataAdapter(str, conn);
行 36: DataSet ds = new DataSet();
行 37: da.Fill(ds, "score");
行 38: DataGrid1.DataSource = ds;
行 39: DataGrid1.DataBind();
源文件: e:\kechen\tcmg.aspx.cs 行: 37
string strcon = "data source=www-51f7b2a9835\\sqlexpress;initial catalog=student;integrated security=SSPI";
SqlConnection conn = new SqlConnection(strcon);
conn.Open();
string sel="select * from teacher where t_no='"+TextBox2 .Text .ToString ().Trim ()+"'and t_pas ='"+TextBox1 .Text.ToString ().Trim () +"'";
SqlCommand cmd = new SqlCommand(sel, conn);
SqlDataReader read = cmd.ExecuteReader();
conn.Close();
if (read.Read())
{
LinkButton1.Visible = true;
LinkButton2.Visible = true;
string str = "SELECT score.c_no, sco.s_no, sco.score FROM score INNER JOIN sco ON score.c_no = sco.c_no";
SqlDataAdapter da = new SqlDataAdapter(str, conn);
DataSet ds = new DataSet();
da.Fill(ds, "score");
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
}
else
{
Label1.Text = "帐号或密码有错误";
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货