Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Going to next page
Message
 
 
To
08/10/2009 19:26:35
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01427461
Message ID:
01428365
Views:
38
>Sorry, but I'm not sure I understand what this means. Could you pretty please put a sample into my code?
>
>
My suggestion:
<asp:ControlParameter ControlID="txtResource" Name="Resource" PropertyName="Text"  Type="String" />
Rename your Text1 into txtResource - it is always a good idea to give some meaningful names.

>>2. You need to add to your SQLDataSource definition OnSelecting = "SqlDataSource1_Selecting" if you want to set your parameter in the code behind. Right now your SQLDataSource doesn't have the event bind.
>>
>
>Tried this and it now looks like
>
>< asp:SqlDataSource ID="SqlDataSource1" runat="server" 
>            ConnectionString="< %$ ConnectionStrings:MySqlConnection %>" 
>            ProviderName="< %$ ConnectionStrings:MySqlConnection.ProviderName %>" 
>            SelectCommand="select * from kpi_woagingvalues where idparameter = @resource" OnSelecting = "SqlDataSource1_Selecting">
>            < SelectParameters>
>               < asp:FormParameter Name="Resource" />
>            < /SelectParameters>
>        < /asp:SqlDataSource>
>Did I do that correctly???
>
>>3. I think you need to add @ in front of the parameter's name in the Selecting event, e.g.
>>e.Command.Parameters("@Resource").Value = TextBox1.Text
>
>I tried this and got an error
>An OdbcParameter with ParameterName '@Resource' is not contained by this OdbcParameterCollection.
pointing to that line
>
>

If you're using ControlParameter, you would not even need to use OnSelecting. For now remove OnSelecting and re-try.

>>BTW, are you using VS or typing your pages manually? Why do you have code behind inside the ASPX?
>
>Using VS. Following the walkthrough one of the instructions was
>
>"Clear the Place code in separate file check box. "
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform