准备制作ASP.NET的网站
在WEB.CONFIG里有 <add key="conStr" value="Server=CHENCHAO-PC\SQLEXPRESS;database=zhuhai_bus;Uid=sa;Pwd=chenchao"/>
Default.aspx.cs 里有SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conStr"]);
SqlCommand cmd = new SqlCommand("select * from [zhuhai_bus] where NUMBER='" + TextBox1.Text + "'", con);
cmd.Connection.Open();
int i = (int)cmd.ExecuteScalar();
cmd.Connection.Close();
if (i > 0)
{
Label1.Text = "OK";
}
else
{
Label1.Text = "BAD";
}
con.Close();可是在 浏览器中预览 系统提示:
对象名 'zhuhai_bus' 无效。 请问有什么解决方法啊
在WEB.CONFIG里有 <add key="conStr" value="Server=CHENCHAO-PC\SQLEXPRESS;database=zhuhai_bus;Uid=sa;Pwd=chenchao"/>
Default.aspx.cs 里有SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conStr"]);
SqlCommand cmd = new SqlCommand("select * from [zhuhai_bus] where NUMBER='" + TextBox1.Text + "'", con);
cmd.Connection.Open();
int i = (int)cmd.ExecuteScalar();
cmd.Connection.Close();
if (i > 0)
{
Label1.Text = "OK";
}
else
{
Label1.Text = "BAD";
}
con.Close();可是在 浏览器中预览 系统提示:
对象名 'zhuhai_bus' 无效。 请问有什么解决方法啊
... select * from [zhuhai_bus] where...
数据库zhuhai_bus里有zhuhai_bus这个对象么?
:)