紧急求助!怎么让Combobox下拉列表显示sqlserver数据库表的名字? 我知道会用到dataset,但是具体应该怎么做呢? ------解决方案-------------------- 数据库的表名/表结构都放在一个叫sysobjects的表中,像查询数据那样查询它就可以了。 ------解决方案-------------------- Select Name from Master..sysobjects where xtype='u' order by name ------解决方案-------------------- +1 ------解决方案-------------------- SqlConnection con = new SqlConnection("server=192.168.2.198;uid=sa;pwd=sa;database=northwind");
SqlCommand cmd = con.CreateCommand();
cmd.CommandText = "Select * from Customers where country='USA'";
SqlDataAdapter adp = new SqlDataAdapter();
adp.SelectCommand = cmd;
DataSet ds = new DataSet();
adp.Fill(ds, "Customers");