468,777 Members | 2,325 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,777 developers. It's quick & easy.

Simple Variable Passing between HTML and ASP

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
Nov 19 '05 #1
3 1615
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
"John Baker" wrote:
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

Nov 19 '05 #2
I Think that works. Now my next problem is how to display the search results!
Password:
Date:
Hours

"Vishnu-Chivukula" <Vi*************@discussions.microsoft.com> wrote:
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
"John Baker" wrote:
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


Nov 19 '05 #3
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
"John Baker" wrote:
I Think that works. Now my next problem is how to display the search results!
Password:
Date:
Hours

"Vishnu-Chivukula" <Vi*************@discussions.microsoft.com> wrote:
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
"John Baker" wrote:
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


Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Robert Rozman | last post: by
27 posts views Thread by one man army | last post: by
41 posts views Thread by SkyBlue | last post: by
2 posts views Thread by monkeyboy | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
2 posts views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.