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.
| Author |
Topic |
|
youz
Starting Member
2 Posts |
Posted - 2009-09-18 : 13:14:38
|
| Hi, I need some help on SQL scripting. Is there a way to use a variable instead of exact value. When I use numeric value like 1.2 AND 1.3 the code works but if I want to use SearchLatdown and SearchLatup instead, an error occurs. Thanks....===============================================================strSQL = "SELECT tblCoord.*, tblCoord.Lat, tblCoord.LatDir, tblCoord.Lon, tblCoord.LonDir FROM tblCoord WHERE tblCoord.Lat Between SearchLatdown AND SearchLatup ; "record.Open strSQL, adoCon===============================================================Error Type:Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.searchtest.asp, line 95 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-09-18 : 14:21:45
|
| SearchLatDown and SearchLatup are variablles local to your application code right? Sql server has no idea what those are. YOu need to build the variable values into your sql string. Perhaps like:"...where tblCood.lat between " & SearchLatDown & " and " & SearchLatup & ";"Be One with the OptimizerTG |
 |
|
|
youz
Starting Member
2 Posts |
Posted - 2009-09-18 : 23:04:33
|
| Thanks a lot TG, It works... |
 |
|
|
|
|
|