ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 04-06-2010
Johannes Cottyn Johannes Cottyn is offline
Flexsim User
 
Join Date: Mar 2010
Posts: 3
Downloads: 1
Uploads: 0
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 0
Johannes Cottyn is on a distinguished road
Default ODBC error

I'm executing an insert query using ODBC as listed below:

dbusername("VSM","****");
dbopen("FlexSimVSM","SELECT * FROM [Segment Response]",0);
dbsqlquery(concat("INSERT INTO [Segment Response] VALUES ('TEST','Aluminum Cutting','TEST','...', 0)"));
dbclose();

The query gets executed correctly by MSSQL but after every query I get an ODBC error in Flexsim, resulting in this annoying popup interupting my simulation:

---------------------------
ODBC Error
---------------------------
Invalid Cursor State


Driver: [Microsoft][ODBC SQL Server Driver]
ODBC Code: 24000
Flexsim Code: 17 - SQLFetchScroll - first
---------------------------
OK
---------------------------

Any ideas on how to avoid this error/popup to occur?

Thanks in advance!
  #2  
Old 04-06-2010
AJ Bobo's Avatar
AJ Bobo AJ Bobo is offline
Flexsim Senior Developer
 
Join Date: Jul 2007
Posts: 108
Downloads: 8
Uploads: 0
Thanks: 23
Thanked 89 Times in 41 Posts
Rep Power: 221
AJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the rough
Default

Johannes,

Is the code that you show there exactly like the code the is causing trouble? Or are you calling any other database commands between the dbsqlquery() and dbclose() calls? If you are calling any other commands, then you need to perform a SELECT statement before reading anything.

Also, what version of Flexsim are you using? There have been a few minor changes to the database system recently. I would like to make sure that you are using the latest version.

Thanks.

A.J.
  #3  
Old 04-06-2010
Johannes Cottyn Johannes Cottyn is offline
Flexsim User
 
Join Date: Mar 2010
Posts: 3
Downloads: 1
Uploads: 0
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 0
Johannes Cottyn is on a distinguished road
Default

No, I'm not calling any statements in between ...

I'm working with version 4.5.0

The code gets executed on the model trigger 'on reset'. I don't know if that makes a difference?

Thanks
  #4  
Old 04-06-2010
AJ Bobo's Avatar
AJ Bobo AJ Bobo is offline
Flexsim Senior Developer
 
Join Date: Jul 2007
Posts: 108
Downloads: 8
Uploads: 0
Thanks: 23
Thanked 89 Times in 41 Posts
Rep Power: 221
AJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the rough
Default

Johannes,

This was a bug that existed in version 4.5. It was fixed for version 4.52. I recommend that you upgrade your installation to avoid this error.

A.J.
The Following 2 Users Say Thank You to AJ Bobo For This Useful Post:
Phil BoBo (04-06-2010)
  #5  
Old 04-08-2010
Johannes Cottyn Johannes Cottyn is offline
Flexsim User
 
Join Date: Mar 2010
Posts: 3
Downloads: 1
Uploads: 0
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 0
Johannes Cottyn is on a distinguished road
Default

Problem solved indeed. Thanks!

Tags
cursor, invalid, odbc, query, sql



All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.