這裏是我的SQL數據源的詳細信息SqlDataSource的選擇參數
<asp:SqlDataSource ID="dsMoodleQuiz" runat="server"
ConnectionString="<%$ ConnectionStrings:OnlineMeetingConnectionString %>"
ProviderName="<%$ ConnectionStrings:OnlineMeetingConnectionString.ProviderName %>"
SelectCommand="SELECT Name, UserID, Grade, FirstName, LastName, Email, TimeModified, IDNumber FROM tbMoodleQuiz WHERE (FirstName = @FirstName) AND (LastName = @LastName)"
onselecting="dsMoodleQuiz_Selecting">
<SelectParameters>
<asp:Parameter Name="FirstName" />
<asp:Parameter Name="LastName" />
</SelectParameters>
</asp:SqlDataSource>
一個GridView的名字gvDetails連接到dsMoodleQuiz。在button click
我想要
gridview得到填充。
這裏是按鈕的代碼單擊
protected void btnSearch_Click(object sender, EventArgs e)
{
dsMoodleQuiz.SelectParameters.Add("@FirstName", System.Data.DbType.String, "Jhon");
dsMoodleQuiz.SelectParameters.Add("@LastName", System.Data.DbType.String, "Wald");
GridView1.DataBind();
}
這是爲什麼不工作...?我是否缺少任何代碼...?感謝幫助
SQLDatasource如何/在哪裏得到填充新的搜索數據實習生獲取附加到gridview ... ??? – bp581