Last post Aug 02, 2012 12:00 PM by troyd73
Aug 02, 2012 10:44 AM|troyd73|LINK
How do you put a http post value into the select command? I am completely lost on this issue. I am very new to asp and database work so please dumb it down for me.
Aug 02, 2012 10:46 AM|bbcompent1|LINK
What do you mean asp? Classic asp as in default.asp? We don't cover that here. We only do asp.net web forms. There are forums out on the net that cover classic asp.
Aug 02, 2012 11:00 AM|troyd73|LINK
No it is asp.net.
Aug 02, 2012 11:22 AM|bbcompent1|LINK
Ok, post your code and we can look at it.
Aug 02, 2012 11:31 AM|troyd73|LINK
* FROM [sheet1] WHERE ID = Request.Form["FirstName"]">
The FirstName is the http post value that comes from the program that launches the page and I can get that to show up in the main body of the form with this <%
%> but got errors saying that "Server tags cannot contain <%...%> constructs" when trying to use it in the SelectCommand.
Aug 02, 2012 11:39 AM|bbcompent1|LINK
Ok, when you want a request form value, you have to use parameterized query. In your datasource, your query will be more like this:
* from [Sheet1] where ID = @ID"
<asp:FormParameter FormField="FirstName" Name="ID" Type="String" />
Aug 02, 2012 12:00 PM|troyd73|LINK
That worked like a charm I had found something similiar and tried that but it didn't work for me. Thanks so much for the help.