我有这个问题, 当表为空时,GridView不显示行标题 我使用.net框架4和Internet Explorer,你能帮助我吗? 这是代码:
this is code
private void loadTCOR27()
{
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds = new DataSet();
try
{
string sql = null;
gridViewTCOR27.Visible = true;
table1.Visible = false;
string connectionString = SestanteWeb.Global.rCRVigServer.leggiStringaConnessioneSicurezzaSqlClient();
sql = "select * FROM [PUMA2_FINANZIARIAFAMILIARE].[dbo].[TCOR27]";
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
SqlCommand command = new SqlCommand(sql, connection);
adapter.SelectCommand = command;
adapter.Fill(ds);
adapter.Dispose();
command.Dispose();
connection.Close();
// gridView1.DataSource = ds.Tables[0];
gridViewTCOR27.DataSource = ds.Tables[0];
gridViewTCOR27.DataBind();
}
catch (Exception ex)
{
}
finally
{
adapter.Dispose();
}
}