Simple Variable Passing between HTML and ASP

J

John Baker

Hi:7

Newby here to ASP, and using the ASP.NET Web Matrix development tool. While that tool
looks great for a Newby, I have run into a snag. I have an HTML Text Box which I have
named HireInput, and a table (Access Table in fact) that has on it a field called HIREID.
I wish to select records where the two match! It sounds simple, but I am having trouble
setting up the text box name so that it is recognized in the query.

Can someone tell me the simple way to do this?

Thanks

John Baker
 
G

Guest

Hi John,

Not too sure what problems you ran into.
I have an HTML Text Box which I have
named HireInput, and a table (Access Table in fact) that has on it a field called >HIREID. I wish to select records where the two match! It sounds simple, but I >am having trouble
setting up the text box name so that it is recognized in the query.

There are a couple of whays to solve this...

One is by using a simple Select Query and the other is by using a Stored
procedure.
In case you want to go with the Query way,
"Select Column1, Column2, Column3 from TableName Where HIREID ='" +
TextBox1.Text + '"
This should be fine..
***Remember, This is not a recomemded way as this code is subject to SQL
Injection. ***

The other way is to write a a stored procedure and Pass the textBox1.Text
value as an input. To Avoid SQL Injection dont directly send the textbox
value to the SP. But use SQL Parameters...

Hope this Helps...

Need any help, Do post a msg back...


Happy Coding
 
J

John Baker

I Think that works. Now my next problem is how to display the search results!
Password:
Date:
Hours
 
G

Guest

Hi John,
You again have qutie a few options to choose from...
Create a datatable and using the DataAdapter's fill method, fill the
datatable with the values being returned from the SP / Query.

Once the datatable is filled ...

For Date:
TextBox.Text / Label.Text = datatable.Rows[0][0].ToString();
( OR )
TextBox.Text / Label.Text = datatable.Rows[0]["ColumnName"].ToString();

Use the above logic to find the data you want in the datatabe and assign it
to your textbox / label control...

HTH,

Need any help, do post a msg back..

Happy Coding
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top