Search the Community
Showing results for tags 'access'.
WPerciful posted a topic in AutoLISP, Visual LISP & DCLIn Feb fixo helped me to write aSQLCon function. I used the function tooquery SQL databases. I have tried towrite one enabling me to query an access database in the same way. But I am at a total loss. (defun SQLControl ( query_statement / adocmd ADOConn adorst data field fields n sqlQuery tmp data1 data2) ;; Fixo ;; http://www.cadtutor.net/forum/showthread.php?84548-LISP-to-query-MS-SQL-Server-Database-return-results-as-list-of-strings (defun tostring (received / temp ) ; Function Syntax: (tostring received) ; received: Variable to be converted to a string (cond ((= (type received) 'STR) received) ((= (type received) 'INT) (itoa received)) ((= (type received) 'REAL) (rtos received)) ((= (type received) 'LIST) (progn (setq temp "") (foreach listitem received (setq temp (strcat temp " " (datatostring listitem) ) ) ) (setq temp (substr temp 2)) (setq received temp) ) ) ) ) (setq SqlCon "Provider=sqloledb;Data Source=SQL\\DESIGNSQL;Initial Catalog=engineering;user id=DraftingDesign;Password=12345" ADOConn(vlax-create-object "ADODB.Connection") ADORst (vlax-create-object "ADODB.Recordset") data1 (list ) data2 (list ) ) (vlax-invoke-method ADOConn 'Open SqlCon nil "" -1) (setq sqlQuery query_statement ADOcmd (vlax-create-object "ADODB.command") ) (vlax-put-property ADOcmd "ActiveConnection" ADOConn) ; optional ; (vlax-put-property cmd2 "CommandTimeout" 30) (vlax-put-property ADOcmd "CommandText" sqlQuery) (vlax-put-property ADOcmd "CommandType" 1) (setq ADORst(vl-catch-all-apply 'vlax-invoke-method (list ADOcmd 'Execute nil 2 1)));OK (setq fields (vlax-get-property ADORst 'Fields)) (vl-catch-all-apply 'vlax-invoke-method (list ADORst 'movefirst)) (while (not (equal :vlax-true (vlax-get-property ADORst 'eof))) (setq tmp nil n 0) (while (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-get-property (list fields 'item n)))) (setq field (vlax-variant-value (vlax-get-property (vlax-get-property fields 'item n) 'value))) (setq tmp (cons field tmp)) (setq n (1+ n)) ) (setq data (append data (list (reverse tmp)))) (vl-catch-all-apply 'vlax-invoke-method (list ADORst 'movenext))) ; use garbage cleaner before of the closing connection: (gc) (vlax-invoke-method ADOConn 'Close) (vlax-release-object ADORst) (vlax-release-object ADOcmd) (vlax-release-object ADOConn) ; (alert (vl-princ-to-string data)); must use (vl-string-trim " " strvalue) for string values within the data list (foreach line data (foreach item line (setq data1 (append data1 (list (cond ((= item nil)"") ((= (type item) 'SYM)(substr (vl-symbol-name item) 7)) ((/=(type item) 'STR)(tostring item)) (T item) ) ) ) ) ) (setq data2 (append data2 (list data1)) data1 (list ) ) ) data2 )
Hi Everyone! I am having a bit of a dilemma. I am trying to find out (not sure what to search for) if it is possible to take data from an OLE and be able to capture it into an ACCESS database. I have an example of what needs to be pulled if this is even possible.
I have an idea for scheduling our plant’s production but I don’t know if it is possible. I would like have your input. We use AutoCAD 2011 and AutoCAD LT 2011. We also use Office 2010. I have some experience with Visual Basic. Here is the problem: We use Excel to schedule production of items in our plant. There are several workstations that produce several items each day. Presently, this activity is organized in a spreadsheet. This spreadsheet is manually updated maybe 2-3 times a day to reflect many variables that affect production. The data for this spreadsheet originates in the engineering department. This data is entered once in engineering for their use. Then again by the plant scheduler for his scheduling use. Then again by the plant scheduler to update our production database once the item is produced. I want to stop the insanity by entering the data once then using it many times as required. Concept of a solution: In AutoCAD, define a custom coordinate grid with days along the x-axis and the workstation numbers along the y-axis. Then, to represent each item to be produced, define blocks that would hold data from a linked Access database and production information (time/workstation, x /y from the AutoCAD file. When item data is updated in the database it would be reflected in the schedule. When the production data and location is changed in the AutoCAD it would be seen in the database. The scheduler could reposition the blocks in the AutoCAD file as needed to change the schedule. I really have no idea if this is possible. The idea came to me during my commute home one day last week. Thanks in advance for your comments.