Question

Locked

text box values as parameters in Stored Procedures???

By nuSkool ·
Hello,

I am using asp.net in Visual Studio 2005. I am trying to get a value from a text box to use as the parameter in a stored procedure. The stored procedure would run and then display the results in the next page. I have googled and checked forums but can not find any examples of how to do this.

I can get a dropdown list to be databound to the grid on the same page but I would like to have a user put in a value click submit and then taken to the next page showing the results. I have tried many different methods but nothing seems to work.

I have for example tried to put ASP tags inside the generated stored procedure statement. tried to use a combo list and then change the name to that of the text box. tried to put the sql inside the submit click event, but no luck.

This is the hardest part of the project for me because I can not find any examples.Any help or direction would be appreciated whether it is links, sample code, the needed logic. Anything.

Thanks in advance.

P.S. I am not a professional programmer. I am a Network Administrator who was thrown into this position and the project is almost done except for this one part.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

As far as I know you can't nor

by Tony Hopkinson In reply to text box values as parame ...

would you want to bind the value of text box to a parameter in an SP and then execute it.

The SP would run every time the user typed a character in the text box. You could trigger it in the OnExit (Onleave) event of the text box, but they tend to be iffy and if there's more than one parameter to set, useless anyway.

Normally you'd put button on there and on it's click even fill the sp's parameters in with the value of the text box(es).

Driving this sort of functionality from end any editing derivative has always been iffy, how do you know when the user has finished entering text?

Collapse -

Sorry...I guess I didn't explain myself clearly...

by nuSkool In reply to As far as I know you can' ...

>>Normally you'd put button on there and on
>>it's click even fill the sp's parameters
>>in with the value of the text box(es).

This is exactly what I want to do but I can't figure out how. There are actually three text boxes the first for a property amount, the second for a fico score, and the third for the amount of debt. Based on these parameters the stored procedure gives a good faith estimate on a loan. The problem is I can't get the buttons click event to go to the next page and display the results in the grid. (I have been using ASP.NET for maybe 2 or 3 months now). We are using VB now but we will port it over to C# before we add any more functionality to the application. I would really appreciate some sample code or a tutorial page that shows how to do this.

Collapse -

ASP is not one of my strong suits

by Tony Hopkinson In reply to Sorry...I guess I didn't ...

But I would have had a html form to collect the parameters with submit. That calls a URL that grabs the parameters from the request runs the sp and then builds the page with the grid on it.

You should be able to find plenty of examples of that sort of behaviour.

This seems to be a start, or a similar idea.

http://www.aspdev.org/articles/generating-asp.net-images-fly/

Yopu can do it with one asp file, no parameters or a get builds the request form, parameters filled in or a put (default mode of a submit from a form) is build the 'answer'

Personally I'd have two ASPs though, easier to maintain and you'll get more reuse out of it.

Back to Web Development Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums