0
我需要通過前綴一個系統過程幫助..從ASP.Net執行存儲過程3.5
exec [your database name]..sp_tables
在這裏,在上面的代碼中的[數據庫名稱]應該是一個文本框的值 這裏是我的代碼..
string DatabaseName = txtbox.Text;
using (SqlDataAdapter sda = new SqlDataAdapter("exec ['"+DatabaseName+"']..sp_tables", conn))
{
DataSet ds = new DataSet();
sda.Fill(ds);
DropDownList2.DataTextField = "TABLE_NAME";
DropDownList2.DataSource = ds;
DropDownList2.DataBind();
}
我收到錯誤
Database '.net'' does not exist. Make sure that the name is entered correctly.
當我執行
exec [.net]..sp_tables
我得到的結果是否正確 有什麼建議? 在此先感謝..