I'm trying to insert a record into a table in a 3-tier database setup, and the middle-tier server generates the error message above as an OLE exception when it tries to add the first parameter to the query.
I've Googled this error, and I find the same result consistently: it comes from having a colon in a string somewhere in your query, which b0rks ADO's SQL parser. This is not the case here. There are no spurious colons anywhere. I've checked and rechecked the object definition against the schema for the table I'm trying to insert into. Everything checks out, and this has my coworkers stumped. Does anyone know what else could be causing this? I'm at my wits' end here.
I'm using Delphi 2007 and SQL Server 2005.
-
If I remember well, you have to explicit put NULL value to the parameter. If you are using a TAdoStoredProc component, you should do this in design time.
-
Are you using any threading? I seem to remember getting this error when a timer event started a query while the ADO connection was being used for another synchronous query. (The timer was checking a "system available" flag every minute).
-
Have you set the DataType of the parameter or did you leave it as ftUnknown?
Mason Wheeler : The data type's been set. -
I can get this error, using Delphi 2007 and MSSQL Server 2008, and I found a workaround. (which is pretty crappy IMHO, but maybe its useful to you if yours is caused by the same thing.)
code to produce the error:
with TADOQuery.Create(nil) do try
Connection := ADOConnection; SQL.Text := ' (SELECT * FROM Stock WHERE InvCode = :InvCode ) ' +' (SELECT * FROM Stock WHERE InvCode = :InvCode ) '; Prepared := true; Parameters.ParamByName('InvCode').Value := 1; Open; // <<<<< I get the "parameter object is...etc. error here. finally Free; end;I found two ways to fix it:
1) remove the brackets from the SQL, ie:
SQL.Text := ' SELECT * FROM Stock WHERE InvCode = :InvCode ' +' SELECT * FROM Stock WHERE InvCode = :InvCode ';2) use two parameters instead of one:
with TADOQuery.Create(nil) do try
Connection := ADOConnection; SQL.Text := ' (SELECT * FROM Stock WHERE InvCode = :InvCode1 ) ' +' (SELECT * FROM Stock WHERE InvCode = :InvCode2 ) '; Prepared := true; Parameters.ParamByName('InvCode1').Value := 1; Parameters.ParamByName('InvCode2').Value := 1; Open; // <<<<< no error now. finally Free; end; -
Here a late reply. In my case it was something completely different.
I tried to add a stored procedure to the database.
Query.SQL.Text := 'create procedure [dbo].[test]' + #13#10 + '@param int ' + #13#10 + 'as' + #13#10 + '-- For the parameter you can pick two values:' + #13#10 + '-- 1: Value one' + #13#10 + '-- 2: Value two';When I removed the colon (:) it worked. As it saw the colon as a parameter.
11 comments:
This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb. This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolites festivity to pity. I appreciated what you ok extremely here
Data science training in Bangalore
Data Science training in marathahalli
Data Science training in btm
Data Science training in rajaji nagar
Data Science training in chennai
Data science training in kalyan nagar
Data Science training in USA
Really you have done great job,There are may person searching about that now they will find enough resources by your post
java training in annanagar | java training in chennai
java training in marathahalli | java training in btm layout
java training in rajaji nagar | java training in jayanagar
java training in chennai
Greetings. I know this is somewhat off-topic, but I was wondering if you knew where I could get a captcha plugin for my comment form? I’m using the same blog platform like yours, and I’m having difficulty finding one? Thanks a lot.
AWS Training in Bangalore | Amazon Web Services Training in Bangalore
Amazon Web Services Training in Pune | Best AWS Training in Pune
AWS Online Training | Online AWS Certification Course - Gangboard
You got an extremely helpful website I actually have been here reading for regarding an hour. I’m an initiate and your success is incredibly a lot of a concept on behalf of me.
Python training in marathahalli
Python training institute in pune
Nice post. By reading your blog, i get inspired and this provides some useful information. Thank you for posting this exclusive post for our vision.
angularjs Training in marathahalli
angularjs interview questions and answers
angularjs Training in bangalore
angularjs Training in bangalore
angularjs online Training
angularjs Training in marathahalli
really you are doing an awesome job..
BEST ANGULAR JS TRAINING IN CHENNAI WITH PLACEMENT
https://www.acte.in/angular-js-training-in-chennai
https://www.acte.in/angular-js-training-in-annanagar
https://www.acte.in/angular-js-training-in-omr
https://www.acte.in/angular-js-training-in-porur
https://www.acte.in/angular-js-training-in-tambaram
https://www.acte.in/angular-js-training-in-velachery
Nice post. Keep doing on.
AngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery
Really you have done great job,There are may person searching about that now they will find enough resources by your post
angular js training in chennai
angular js training in omr
full stack training in chennai
full stack training in omr
php training in chennai
php training in omr
photoshop training in chennai
photoshop training in omr
Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites!
Angular js Training in Chennai
Angular js Training in Velachery
Angular js Training in Tambaram
Angular js Training in Porur
Angular js Training in Omr
Angular js Training in Annanagar
I do agree your blog for quiz programming concepts, which is very helpful to grow up your knowledge. keep sharing more
IELTS Coaching in chennai
German Classes in Chennai
GRE Coaching Classes in Chennai
TOEFL Coaching in Chennai
Spoken english classes in chennai | Communication training
Digital marketing is the component of marketing that utilizes internet and online based digital technologies such as desktop computers, mobile phones and other digital media and platforms to promote products and servicesJava training in chennai
python training in chennai
web designing and development training in chennai
selenium training in chennai
digital-marketing training in chennai
Post a Comment