Jump to content
  • Advertisement
Sign in to follow this  
JonW

Repeating OLE DB Parameters

This topic is 3431 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have an SQL query like the following: SELECT * FROM WorldObjects WHERE (((@x1 >= BOUND_MIN_X AND @x1 <= BOUND_MAX_X) OR (BOUND_MIN_X >= @x1 AND BOUND_MIN_X <= @x2)) AND ((@y1 >= BOUND_MIN_Y && @y1 <= BOUND_MAX_Y) OR (BOUND_MIN_Y >= @y1 AND BOUND_MIN_Y <= @y2))) As you can see there are 4 named parameters in the query: @x1, @x2, @y1, and @y2. The problem I'm having is that I wish to run the query against a SQL Server database using the C/C++ OLE DB API, and apparently, OLE DB does not support named parameters. Instead, it appears I have to do this: SELECT * FROM WorldObjects WHERE (((? >= BOUND_MIN_X AND ? <= BOUND_MAX_X) OR (BOUND_MIN_X >= ? AND BOUND_MIN_X <= ?)) AND ((? >= BOUND_MIN_Y AND ? <= BOUND_MAX_Y) OR (BOUND_MIN_Y >= ? AND BOUND_MIN_Y <= ?))) which references the parameters by ordinal. However, this would mean that I would have to specify the 4 parameters multiple times so the database would know which parameters to use, if I understand correctly. Is my understanding of OLE DB's use of parameters correct? And is there any way to run this query without repeating parameters? Thanks!! [Edited by - JonW on July 21, 2009 8:37:56 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!