Geek-O: protected void SqlDataSourcePersonal_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
SqlDataSourcePersonal.SelectCommand += String.Format(" WHERE (UserId = {0})", ThisUserId.ToString());
}
I don't think this is the way how you should be doing this.
First you need to change the query in your select command directly in the SQL data source declaration:
Geek-O:SelectCommand="SELECT [Age], [DOB], [Gender], [ChestSize], [CupSize], [Waist], [Height], [Hips], [Weight], [HairColor] FROM [Personal_Stats]"
SelectCommand="SELECT [Age], [DOB], [Gender], [ChestSize], [CupSize],
[Waist], [Height], [Hips], [Weight], [HairColor] FROM [Personal_Stats] where UserId = @UserId"
Then you need to declare this parameter in the select parameter's collection for the data source.
<SelectParameters>
<asp:Parameter Name="UserId" Type="String" />
</SelectParameters>
Then in the data source selecting event modify your code like:
protected void SqlDataSourcePersonal_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.Parameters["@UserId"].Value = ThisUserId.ToString();
}
There are of course other ways of using the parameters in your data source commands ( select, insert, update, delete ) for that you may refer to the MSDN.
Thanks.
Dhimant Trivedi
"When the going gets tough, the tough get going."
PS: Be sure to "Mark as Answer" the post which answered your question.