Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

use a value from from for a select statement

Not applicable
Hello All!



It seems like a pretty simple question, but I can't find the answer, or I'm not looking in the right area.



I have a form, it has a employee number the user fills in. I have a connection created to SQL 2005. I want to call that employee number which is EmpNumTxt so it part of my Select statement. So when a employyes number is put in, it displays the name of that person.



SELECT EmpName from EmpTable WHERE "the text box on my form" = EmpNumber.



How do I call that value in the text box?



Thanks!



Jim
6 Replies
Not applicable
Hi Jim,



If I understand you are asking for the proper naming syntax for the textfield you added to your form.



1) In the Script Editor position your cursor where you want the textfield object proper name.



2) Move the mouse pointer over the textfield on your form and hold down the ctrl key. The mouse pointer will turn to a "V" shape. Click the textfield object and it will paste the proper naming syntax where the cursor is positioned in the Script Editor.



If I misunderstood what you were conveying please explain further.



Thanks

Pam
Not applicable
Hi Pam!

Thanks for the reply. I tried that, but it didn't work. Let me try to explain this better.



I have a form with a employee number on it. I have a table in SQL that holds employess name, number address, etc. So I need when a user enters employee number '55', the name Tom Jones will appear in another text box.



The way I would normally do this is..

SELECT [Name]

FROM List2

WHERE [File] = @Numb



@Numb would equal that value in the employee number text box. How can I take that value in my employee number box and pass it to my SELECT statement. Thus retruning a emp name.



Thanks for you help!



Jim
Not applicable
Adding more to this.



I found this, with no answer. But this is my problem as well.



I'm trying to connect to a SQL Server DB to automatically fill certain form fields. I can create the connection, but then I am presented with a screen to select the data collection method - either Table, Stored Procedure, or SQL Query. I choose Stored Proc, but when I try to proceed I get the following error:



Stored Procedure has non-optional parameters.



How do I pass the stored procedure the parameter?



Here is my SP

SELECT [Name]

FROM List2

WHERE [File] = @Numb



Thanks!



Jim
Not applicable
Does anyone have a solution to Jim's question? I need to know how to create a variable for a user-entered field, and have that variable be used in a SQL Server 2005 query associated with other fields on the form. In my situation, I chose SQL Query rather than Stored Proc, but the answer should be the same for both methods.
Not applicable
I am working on the same problem, have the same question. It seems like such a simple solution and problem and I am wondering why there is not a response.
gkaiseril
Level 7
Level 7
You should be using JavaScript's "switch()" statement.



switch(DropDownList1.rawValue) {

case "One":

$.rawValue = "One";

break;

case "Two":

$.rawValue = "Select 2";

break;

case "Three":

$.rawValue = "3 Selected";

break;

default:

$.rawValue = "None";

break;

}