Wednesday, March 7, 2012

only when i use a grid view!

hi, i have done some testing and its only when i put a grid view or any other type of data viewer on the page, and then connect it to the sql datasource that i get an error

Line 1: Incorrect syntax near ')'.

now i really cant figure out what it is, here is the code i am using

SQL data source code :

asp

:SqlDataSourceID="SQLDS_view_one_wish"runat="server"ConnectionString="<%$ ConnectionStrings:wishbank_DBCS %>"SelectCommand="SELECT [msg], [Date_Time] FROM [tbl_MSG] WHERE (([Activated] = @.Activated) AND ([msgID = @.msgID]) )ORDER BY [Date_Time] DESC"><SelectParameters><asp:ParameterDefaultValue="Y"Name="Activated"Type="String"/><asp:SessionParameterName="msgID"SessionField="sWV"Type="String"/></SelectParameters></asp:SqlDataSource>

session variable code which sends it to this page

protectedvoid GridView1_SelectedIndexChanged(object sender,EventArgs e)

{

GridViewRow row = GridView1.SelectedRow;

Session[

"sWV"] = row.Cells[1].Text;

Response.Redirect(

"www/viewwf.aspx");

}

if you have an idea please let me know as im stuck!

TRY THIS:

<asp:SqlDataSource ID="SQLDS_view_one_wish" runat="server"SelectCommandType="Text" ConnectionString="<%$ ConnectionStrings:wishbank_DBCS%>"SelectCommand="SELECT [msg], [Date_Time] FROM [tbl_MSG] WHERE (([Activated] = @.Activated) AND ([msgID = @.msgID]) )ORDER BY [Date_Time] DESC"><SelectParameters><asp:Parameter DefaultValue="Y" Name="Activated" Type="String" /><asp:SessionParameter Name="msgID" SessionField="sWV" Type="String" /></SelectParameters></asp:SqlDataSource>

No comments:

Post a Comment