Select SQL 使用 c# 错误有人可以指导这个吗

Select SQL using c# error can someone guide this one

我错过了什么?
我有错误:

Sqlexception was unhandled by usercode

SqlConnection con = new SqlConnection(MyConnectionString);
SqlCommand objCmd;
con.Open();
SqlDataReader dtReader;
String strSQL;
strSQL = "SELECT * FROM " + DropDownList1.SelectedValue + "'";

objCmd = new SqlCommand(strSQL, con);
dtReader = objCmd.ExecuteReader();

//*** BindData to GridView ***//
GridView3.DataSource = dtReader;
GridView3.DataBind();

dtReader.Close();
dtReader = null; 

试试这个,

  strSQL = "SELECT * FROM " + DropDownList1.SelectedValue;

即,只需从查询字符串中删除 '。

然后在最后添加如下代码

GridView3.DataSource = dtReader;
GridView3.DataSourceID = String.Empty;
GridView3.DataBind(); 

此代码现在有效

  SqlConnection con = new SqlConnection(MyConnectionString);
SqlCommand objCmd;
con.Open();
SqlDataReader dtReader;
String strSQL;
strSQL = "SELECT * FROM " + DropDownList1.SelectedValue ;

objCmd = new SqlCommand(strSQL, con);
dtReader = objCmd.ExecuteReader();

GridView3.DataSource = dtReader;
GridView3.DataSourceID = String.Empty;
GridView3.DataBind(); 

dtReader.Close();
dtReader = null;