Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with a SQL Query with VB 6 1

Status
Not open for further replies.

McKaulick

Programmer
Oct 24, 2002
35
0
0
AR
When I executes this query, I get this error, and I really don't know why. And I can't test the query result on the query analyser of Sql Server tools. Can anybody could me help figure out what could be my problem.

This error is showing when I try to open the connection
Run-Time error '-2147217900(80040e14)
Syntax error or access violation

Here's the query

sSql2 = "SHAPE {SELECT Description, committeeID FROM tabLstCommittee} " & _
"AS comCommittee APPEND ({SELECT tabPeopleOther.strFname & ' ' & " & _
"tabPeopleOther.strLname AS strFname, tabPeopleOther.lngPhone, " & _
"tabPeopleOther.lngBusPhone, tabPeopleOther.strEmail, tabCommittees.CommitID, " & _
"tabCommittees.strPosition, tabCommittees.bRemoved FROM tabCommittees, " & _
"tabPeopleOther WHERE tabCommittees.MemberID = tabPeopleOther.PersonID AND " & _
"tabCommittees.bRemoved = 0} AS comMembers RELATE 'Description' TO 'CommitID') " & _
"AS comMembers"
objrs.Open sSql2, strDSN, adOpenStatic, adLockReadOnly

Thx
 
What have you already checked?

-used a simple query to determine connection string is ok?
-used a debug.print to verify that sql statement being passed looks as you expected?
-tested pieces of your query prior to putting it all together?

I wouldn't want to reinvent the wheel. I am not familiar with "SHAPE" and when I tried to use it in Query Analyser it said it didn't recognize it.
 
Be careful when using Shape you cannot use a normal connection string. You have to use the SHAPE Provider. The first thing I would check is the Cursor. You CANNOT use Server Side Cursors with the SHAPE Command.

Brian Gillham
FailSafe Systems
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top