using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;//
using System.Data.Sql;//
using System.Data.SqlClient;//
namespace 省份
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string str1 = "select name from sysobjects where xtype='u'";//提取所有表名
string constr = "Server=LWH;Database=rain;user=sa;password=********";//连接数据库
SqlConnection conn = new SqlConnection(constr);//
ArrayList list = new ArrayList();
try
{
conn.Open();
SqlCommand cmd = new SqlCommand(str1, conn);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
list.Add(dr.GetValue(0));
}
comboBox1.DataSource = list;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
//finally
//{