SqlDataSource的SelectCommand里头怎么加自定义参数
Me.SqlMsg.SelectCommand = "Select Top 10 * From Message Where user_id is null and message_id not in (select message_id from MessageRead where user_id=" & UserID & ")order by date_created desc"
Me.SqlMsg.DataBind()
UserID是自己的变量 不是session form 等等
但是在选择配置参数的SqlDataSource面板里只有session cookie form那几个, 但是我想要自定义值
------解决方案--------------------where中条件选择的时候,选择none,然后定义值,在后台给那个值赋值就行
SelectCommand="SELECT * FROM [urlname] WHERE ([id] = @id)"
------解决方案-------------------- SqlCommand cmd = new SqlCommand("select * from 表 where id=@id", conn);
cmd.Parameters.AddWithValue("@id", "你要添加的值");