如何给SqlDataSource 的参数初始化
就是要改变前台SqlDataSource InsertCommand所产生的sql 语句,想加个字段
<asp:SqlDataSource ID= "SqlDataSource1 " runat= "server " ConnectionString= " <%$ ConnectionStrings:SelClassConnectionString %> "
InsertCommand= "INSERT INTO [zjut_examClassTable] ([examDate] , [examTime], [examPlace],[examDiffType],[studentNumb],[remark],[examId]) VALUES (@examDate, @examTime, @examPlace, @examDiffType, @studentNumb, @remark,@examId) "
<InsertParameters>
<asp:Parameter Name= "examDate " />
<asp:Parameter Name= "examTime " />
<asp:Parameter Name= "examPlace " />
<asp:Parameter Name= "examDiffType " />
<asp:Parameter Name= "studentNumb " />
<asp:Parameter Name= "remark " />
<asp:Parameter Name= "examId " /> (这个属性)
</InsertParameters>
</asp:SqlDataSource>
我想在 SqlDataSource插入一条语句时,examId 的值有后台程序来赋值
------解决方案--------------------SqlDataSource Inserting 事件 中
e.Command.Parameters[ "examId "] = myValue;