By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,780 Members | 1,549 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,780 IT Pros & Developers. It's quick & easy.

Simple Variable Passing between HTML and ASP

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.