连接数据库时的问题...
public SqlDataReader Reader(){
SqlConnection MyConnection = new SqlConnection("server=F087589640C345A\\SQLEXPRESS;user=sa;pwd=accp;database=MyBookShop");
MyConnection.Open();
string message = string.Format("select * from {0}",this.TextBox1);
SqlCommand MyCommand = new SqlCommand(null, MyConnection);
MyCommand.CommandText = message;
SqlDataReader MyDataReader = MyCommand.ExecuteReader();
return MyDataReader;
}
[img=C:\Documents and Settings\Administrator.F087589640C345A\桌面][/img] --------------------编程问答-------------------- 图? ?? --------------------编程问答-------------------- 对象 名称 'System.Web.UI.WebControls.TextBox' 包含的前缀超出了最大限值。最多只能有 3 个
这个错 --------------------编程问答-------------------- this.TextBox1.Text --------------------编程问答-------------------- this.TextBox1.Text 才是文本框里面的内容... --------------------编程问答-------------------- LZ 5个帖子都没结啊 --------------------编程问答-------------------- 怎么结贴告分不够呢.... .. --------------------编程问答-------------------- this.TextBox1.Text 才是文本框里面的内容... --------------------编程问答-------------------- suing(SqlConnection MyConnection = new SqlConnection(""))
{
MyConnection.Open();
string message = string.Format("select * from {0}",this.TextBox1.Text);
}
--------------------编程问答-------------------- using(SqlConnection MyConnection = new SqlConnection(""))
{
MyConnection.Open();
string message = string.Format("select * from {0}",this.TextBox1.Text);
}
--------------------编程问答-------------------- using(SqlConnection MyConnection = new SqlConnection(""))
{
MyConnection.Open();
string message = string.Format("select * from {0}",this.TextBox1.Text);
}
补充:.NET技术 , ASP.NET