数据库名称的读取
//将数据库的名称独取出来 public void bindDropDown() { //以下这条sql语句我很奇怪,就是一定要添加master..sysdatabases才行,要是直接 写sysdatabases这样会报错,说找不到表 string sql = "select [name] from master..sysdatabases where [name] not in('master','tempdb','model','msdb')"; DataQueryHelper qhelper = new DataQueryHelper(); DataTable dt= qhelper.getDataView(sql).Tables[0]; ddlBackupDb.DataSource = dt.DefaultView; ddlBackupDb.DataValueField = "name"; ddlBackupDb.DataTextField = "name"; ddlBackupDb.DataBind(); ddlBackupDb.Items.Insert(0,new ListItem("请选择数据库"," ")); }