Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Associated statement is not prepared
Message
 
 
À
07/12/2012 15:02:56
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01559065
Message ID:
01559082
Vues:
36
>>>This error message is about as useless as a boar hog on ice skates as I can't find anything that explains what this means.
>>>
>>>Has anyone run into this before? How did you figure it out?
>>>
>>>
>>>Here's what happened.
>>>Modified a stored proc, saved it and executed it - executed with no errors.
>>>
>>>Try to call it from VFP and I get this error.
>>>
>>>AError returns
>>>1) 1526
>>>2) "Connectivity error.[Microsoft][ODBC SQL Server Driver]Associated statement is not prepared"
>>>3) [Microsoft][ODBC SQL Server Driver]Associated statement is not prepared"
>>>4) "S1007"
>>>5) 0
>>>6) 1
>>>7) .NULL.
>>>
>>>SP is as follows
>>>
>>>USE [TestingExpECL]
>>>GO
>>>/****** Object:  StoredProcedure [dbo].[UpdateMaster]    Script Date: 12/07/2012 10:55:39 ******/
>>>SET ANSI_NULLS ON
>>>GO
>>>SET QUOTED_IDENTIFIER ON
>>>GO
>>>-- =============================================
>>>-- Author:		Dorrie Beaird
>>>-- Create date: November 2012
>>>-- Description:	Updates Experimental Master Record
>>>-- =============================================
>>>ALTER PROCEDURE [dbo].[UpdateMaster]
>>>  @MasterID int,
>>>  @Cat		nchar(2),
>>>  @DL		nchar(1),
>>>  @ALC		nchar(3),
>>>  @Key1		nvarchar(max),
>>>  @key2		nvarchar(max),
>>>  @CR		nchar(1),
>>>  @Script	                nvarchar(max),
>>>  @Stem		nvarchar(max),
>>>  @RA		nvarchar(max),
>>>  @RB		nvarchar(max),
>>>  @RC		nvarchar(max),
>>>  @RD		nvarchar(max),
>>>  @ST		int,
>>>  @EN		nvarchar(max),
>>>  @IS		bit,
>>>  @RevB		nchar(3),
>>>  @RevD		date,
>>>  @CO		bit
>>>  	
>>>AS
>>>BEGIN
>>>  declare @iError int, @iRowCnt int
>>>  SET NOCOUNT ON;
>>>  begin transaction
>>>  update [TestingExpECL].[dbo].[ExpMaster] set
>>>    [Category] = @Cat,[DiffLet] = @DL,[alc] = @ALC,[Keyword] = @Key1,
>>>    [Keyword2] = @Key2,[CorrectResp] = @CR,[Script] = @Script,[stem] = @Stem,
>>>    [RespA] = @RA,[RespB] = @RB,[RespC] = @RC,[RespD] = @RD,[ScriptTime] = @ST,
>>>    [EnterNotes] = @EN,[IncSave] = @IS,[ReviewedBy] = @RevB,[ReviewDate] = @RevD,[Completd] = @CO
>>>    where XPID = @MasterID
>>>  if @iError > 0
>>>    begin
>>>      raiserror('Error on Master Update -  %d',16,1, @iError) 
>>>      rollback transaction
>>>    end
>>>  commit transaction
>>>END
>>>
>>>
>>>My parameter statements are as follows:
>>>
>>>  m.param1 = "?EditRec.XpID,?EditRec.Category, ?EditRec.DiffLet, ?EditRec.ALC, ?EditRec.Keyword, ?EditRec.Keyword2, " + ;
>>>       "?EditRec.CorrectResp, " 
>>>  m.param2 = "?STRTRAN(EditRec.Script, CHR(13), '/n'), ?STRTRAN(EditRec.Stem, CHR(13), '/n'), ?EditRec.RespA, " + 
>>>       "?EditRec.RespB, ?EditRec.RespC, ?EditRec.RespD," 
>>>  m.param3 = "?EditRec.ScriptTime, ?STRTRAN(EditRec.EnterNotes, CHR(13), '/n'),  ?IIF(EditRec.IncSave, 'True','False'), ?null," 
>>>  m.param4 = " ?null,  ?'False'"
>>>
>>
>>First of all, as Boris said, you never set @iError or @iRowCnt variables (do you need the second variable at all - did you intend to return it)?
>>
>>If you're using SQL Server 2005 or up, I suggest to use TRY/CATCH mechanism to execute statements and return errors to the user
>>
>>Your parameters in VFP also are incorrect. You only need to use ? with real parameters (and don't do any operations on them, do all operations before) and for the constants don't use ?, just pass them as is without ?
>
>It hasn't horked on having the '?', but it has when I've left it off

Can you see what is the command you're sending to the SQL Server by using SQL Server profiler?

Try creating the variables then for your constant values, e.g.

lnNull = null

llIs = EditRec.lncSave

etc.

and pass them using ? syntax.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform