异常详细信息: System.Data.SqlClient.SqlException: 第 1 行: ',' 附近有语法错误。
if(!this.IsPostBack){stringsql1="selecttop4flinumber,flicity,reacity,moneyfromtejia";...
if (!this.IsPostBack)
{
string sql1 = "select top 4 flinumber,flicity,reacity,money from tejia ";
SqlConnection con = uc.getcon();
SqlDataAdapter da = new SqlDataAdapter(sql1, con);
DataSet ds = new DataSet();
da.Fill(ds, "Gridwiew");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
if (ds.Tables[0].Rows[i]["flinumber"].ToString().Length > 15)
{
ds.Tables[0].Rows[i]["flinumber"] = ds.Tables[0].Rows[i]["flinumber"].ToString().Substring(0, 15) + "…";
}
else
{
ds.Tables[0].Rows[i]["flinumber"] = ds.Tables[0].Rows[i]["flinumber"].ToString();
}
}
this.DataGrid1.DataSource = ds.Tables[0];
this.DataGrid1.DataBind();
}
} 展开
{
string sql1 = "select top 4 flinumber,flicity,reacity,money from tejia ";
SqlConnection con = uc.getcon();
SqlDataAdapter da = new SqlDataAdapter(sql1, con);
DataSet ds = new DataSet();
da.Fill(ds, "Gridwiew");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
if (ds.Tables[0].Rows[i]["flinumber"].ToString().Length > 15)
{
ds.Tables[0].Rows[i]["flinumber"] = ds.Tables[0].Rows[i]["flinumber"].ToString().Substring(0, 15) + "…";
}
else
{
ds.Tables[0].Rows[i]["flinumber"] = ds.Tables[0].Rows[i]["flinumber"].ToString();
}
}
this.DataGrid1.DataSource = ds.Tables[0];
this.DataGrid1.DataBind();
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询