Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting Dim filter As Integer If IsNumeric(TextBox1.Text) Then filter = Convert.ToInt32(TextBox1.Text) Else filter = 0 End If e.Command.Parameters("@Resource").Value = filter End SubIn the original code I showed using the form variable syntax. Honestly, if you're populating it directly you can just use a SelectParameter. So your SQlDataSource would look something like this - notice we're specifying the underlying type of the database field:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MySqlConnection %" ProviderName="<%$ ConnectionStrings:MySqlConnection.ProviderName %" SelectCommand="select * from store where iid = @Resource" <SelectParameters <asp:Parameter DbType="Int32" DefaultValue="0" Name="Resource" / </SelectParameters </asp:SqlDataSource