当前位置: 代码迷 >> ASP.NET >> 出现错误
  详细解决方案

出现错误

热度:4126   发布时间:2013-02-25 00:00:00.0
出现异常
using   System;
using   System.Data;
using   System.Configuration;
using   System.Web;
using   System.Web.Security;
using   System.Web.UI;
using   System.Web.UI.WebControls;
using   System.Web.UI.WebControls.WebParts;
using   System.Web.UI.HtmlControls;
using   System.Data.SqlClient;
public   partial   class   _Default   :   System.Web.UI.Page  
{
        protected   void   Page_Load(object   sender,   EventArgs   e)
        {
                string   No   =   " ";
                string   Name   =   " ";
                string   Lesson   =   " ";
                string   Msg   =   " ";
                if   (IsPostBack)
                {
                        No=Request[ "txtNo "];
                        Name=Request[ "txtName "];
                        Lesson=Request[ "Lesson "];
                        string   SQL   =   "select   *   from   成绩单 ";
                        SQL   =   SQL   +   "where   学号= "   +   " ' "   +   No   +   " ' "   +   "and   姓名= ' "   +   Name   +   " ' ";
                        SqlConnection   Conn   =   new   SqlConnection( "server=.;database=test;uid=sa;pwd=chaustar ");
                          Conn.Open();
                        SqlCommand   Comm   =   new   SqlCommand(SQL,Conn);
                        SqlDataReader   dr   =   Comm.ExecuteReader();
                        if   (dr.Read())
                        {
                                if   (dr[Lesson].ToString()   !=   "-1 ")
                                {
                                        Msg   =   "你已经考过本科目了! ";
                                }
                                else
                                {
  相关解决方案