Click here to Skip to main content
16,023,124 members

Comments by Member 16146638 (Top 5 by date)

Member 16146638 23-Nov-23 8:06am View    
Hello Richard
He really does not like it. Even if I use only the fields in the index and in the exact order the same error appears. So still the same problem.
Member 16146638 23-Nov-23 7:18am View    
Hello Richard
The first 3 fields are exactly in the order of the key, only the last item is not in the key - do you think that that is the problem ?
Member 16146638 23-Nov-23 4:49am View    
The message is 'System.Data.SqlClient.SqlException: 'Query processor could not produce a query plan because of the hints defined in this query. Resubmit the query without specifying any hints and without using SET FORCEPLAN.''
Member 16146638 23-Nov-23 4:25am View    
I open the database as follows:
conLocDb = New System.Data.SqlClient.SqlConnection
cmdLocDb = New System.Data.SqlClient.SqlCommand
conLocDb.ConnectionString = "Server=" + strLocDbDatasource + ";Database=" +
strLocDbDefaultcoll + ";Trusted_Connection=True;"
cmdLocDb.CommandTimeout = 0
conLocDb.Open()
cmdLocDb.Connection = conLocDb

Then my read is as follows:
cmdLocDb.CommandText = "Select IcData From Iscode with(index(Iscode01))" +
"Where IcCodt = 'GLSI' " +
"and IcCode = '" + Format(intCity, "000") + " SCOASO' " +
"and IcLang = 0 " +
"and IcAudl = 0"
Reader = cmdLocDb.ExecuteReader()

I have to remove the 'with(index...' for it to run, but would like to specify the index
So the question is where can i specify the 'forceplan' set ?
Member 16146638 23-Nov-23 4:07am View    
Thanks Richard, but i have to specify it in VB code - that is the real problem