Search Results

Search found 2 results on 1 pages for 'mattec'.

Page 1/1 | 1 

  • Updating asp:SqlDataSource Parameter via asp:LinkButton

    - by Mattec
    I'll try to explain what I'm doing the best I can, but I'm pretty new to asp.net so be patient with me. I have a SqlDataSource which returns a simple select statement based on the WHERE clause using @COURSE_ID What I want to-do is every time any one of 2 (this will change as it's going to be generated) asp:LinkButtons are pressed, they will change the @COURSEID value which i'd like to associate with the specific button. Buttons: <asp:LinkButton ID="LinkButton2" runat="server" onclick="MenuUpdate_Click">Course1</asp:LinkButton> <asp:LinkButton ID="LinkButton1" runat="server" onclick="MenuUpdate_Click">Course2</asp:LinkButton> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connString %>" SelectCommand="SELECT Chapter.chapterName, Chapter.chapterID FROM Chapter WHERE Chapter.courseID = @COURSE_ID " C# protected void MenuUpdate_Click(object sender, EventArgs e) { Parameter p = SqlDataSource1.SelectParameters["COURSE_ID"]; SqlDataSource1.SelectParameters.Remove(p); SqlDataSource1.SelectParameters.Add("COURSE_ID", THIS NEEDS TO BE VALUE ASSOCIATED TO BUTTON); ListView1.DataBind(); UpdatePanel1.Update(); } If anyone has any suggestions that'd be great, I've been trying lots of different things all night with no success :( Thanks

    Read the article

  • Incorrect syntax near ''. Unclosed quotation mark after the character string ' '.

    - by Mattec
    I'm just wondering if someone could point me in the right direction here, I think i've been looking at it for too long so can't see the mistake. The following code: SqlCommand updateStyle = new SqlCommand("UPDATE [Lorenz].[dbo].[Layout] SET [bgColour] = '" + bgColour + "' , [textColour] = '" + txtColour + "WHERE <[LoweredUserName] ='" + currentUser + "' ", connection); updateStyle.ExecuteNonQuery(); Is giving the error: Incorrect syntax near 'admin'. Unclosed quotation mark after the character string ' '.

    Read the article

1