您的位置:首页 > 编程语言 > ASP

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

2009-06-03 22:21 295 查看
求助: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>

结果中列表框中什么都没有。。。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: