求助:asp.net中为什么连接不到数据库???

来源:互联网 发布:mac创建电脑账户 编辑:程序博客网 时间:2024/06/10 07:53

 求助:asp.net中以下程序为什么连接不到数据库???
void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            string str = "Persist Security Info=false;Initial Catalog=Northwind;";
            str += "Data Source=LENGFENG;Integrated Security=SSPI";
            SqlConnection con = new SqlConnection(str);
            string comstr = "select lastname from employees;";
            SqlCommand com = new SqlCommand(comstr, con);
            SqlDataAdapter myDA = new SqlDataAdapter();
            myDA.SelectCommand = com;
            con.Open();
            DataSet myDS = new DataSet();
            myDA.Fill(myDS, "employees");
            select1.DataSource = myDS.Tables["Emplyees"];
            select1.DataBind();
        }
    }
<form id="form1" runat="server">
    <select id="select1"   runat="server">
    </select>
</form>

 

结果中列表框中什么都没有。。。。。

原创粉丝点击