日期:2014-05-17  浏览次数:20596 次

异常详细信息: System.InvalidCastException: 指定的转换无效。
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 QianFei_QianfeiXiangxi : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!this.IsPostBack)
        {
            string name = Request["name"];
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString());
            con.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "select * from tb_qianfei where name='" + name + "'";
            cmd.ExecuteNonQuery();
            SqlDataReader sdr = cmd.ExecuteReader();
            sdr.Read(); 
            if (name!= "")
            {
                this.lblqfname.Text = sdr.GetString(0).ToString();
                this.lblzz.Text = sdr.GetString(1);
                this.lbllb.Text = sdr.GetString(2);
                this.lblrqzs.Text = sdr.GetDateTime(3).ToShortDateString();
                this.lblzzsj.Text = sdr.GetDateTime(4).ToShortDateString();
                this.lblje.Text = sdr.GetFloat(5).ToString();
                this.Lblzt.Text = sdr.GetString(6).ToString();
                this.lbljsr.Text = sdr.GetString(7).ToString();
            }
            else
            {
                Response.Write(