Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Can one pass local variable into sql statement?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-10 : 07:59:18
Shannon writes "I’m trying to access one row in a table based upon its int value held locally in a variable. (I increment the 'count' variable in the application.) As you can see below, 'count' is the local variable in the application. Can this be done or is there another way?
-Shannon

If count < iResultQuery Then
myConn_.CommandText =
"SELECT WorkInstructions.InstructionText
FROM WorkInstructions WHERE WorkInstructions.StepNo = count"
end if"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-10 : 08:53:44
If you use VB as your Front end then

If count < iResultQuery Then
myConn_.CommandText = "SELECT WorkInstructions.InstructionText
FROM WorkInstructions WHERE WorkInstructions.StepNo = " & count & ""
end if

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -