(在线等)DataGrid直接显示子行的问题
代码如下:
conn = new SqlConnection( "server=SJG\\SQLEXPRESS;integrated security=SSPI;database=master ");
conn.Open();
if (sql != " ")
sql = " ";
else
sql = "select name from sysdatabases order by DBID ";
SqlCommand cmd = new SqlCommand(sql,conn);
DataSet ds = new DataSet();
SqlDataAdapter sda = new SqlDataAdapter(sql,conn);
sda.Fill(ds);
//dataGrid1.AllowNavigation = false;
//ds.Relations.Clear();
dataGrid1.SetDataBinding(ds, " ");
运行后DataGrid只能显示一个+,双击后才能显示真正的数据库表名列表,
怎么样才能直接显示数据库名的列表而不用双击
------解决方案--------------------dataGrid1.DataSource=ds.Table[0];