xiaosi2309
发表于 2004-12-7 09:27:00
斑主可真是有风度啊,来去自由,心肠好
rhyme
发表于 2005-1-10 17:20:00
斑竹帮帮忙,小弟有问题请教!
qq:6315551
yinruch01
发表于 2005-4-10 23:15:00
本人加载vlisp程序后,CAD老提示QUIT/EXIT ABORT,不知是什么原因?
zichang
发表于 2005-5-18 17:27:00
是啊!做人要“厚道”!心胸宽广点好!NB也不好!
54flying
发表于 2005-10-16 20:47:00
真是一个好地方
NetBee
发表于 2005-11-17 20:43:00
<P>排序函数:能根据X、Y条件对坐标表进行各种排序<A href="http://bbs.mjtd.com/forum.php?mod=viewthread&tid=9546" target="_blank" >http://bbs.mjtd.com/forum.php?mod=viewthread&tid=9546</A></P>
无痕
发表于 2005-11-24 16:40:00
网蜜(netbee)你的图标不错:)
lhtfh
发表于 2005-12-27 23:47:00
好,一点有用的东西,谢谢了哦!
nameld001
发表于 2006-5-19 23:48:00
<P><A name=31581><FONT color=#990000><B>meflying</B></FONT></A>版主</P>
<P>看了你写的以下程序运行成功,非常好,谢谢</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; WORD-BREAK: break-all; LINE-HEIGHT: 12pt"><FONT face="Times New Roman">(defun DbInitADO ( / ADO_DLLPath) <BR> (if (null adom-Append) <BR> (progn <BR> (setq ADO_DLLPath <BR> (strcat (getenv "systemdrive") <BR> "\\Program Files\\Common Files\\System\\Ado\\") <BR> ) <BR> ;; </FONT>如果查找到类型库<FONT face="Times New Roman"> ... <BR> (if (findfile (strcat ADO_DLLPath "msado15.dll")) ;; </FONT>将其输入<FONT face="Times New Roman"> <BR> (vlax-Import-Type-Library <BR> :tlb-filename (strcat ADO_DLLPath "msado15.dll") <BR> :methods-prefix "adom-" <BR> :properties-prefix "adop-" <BR> :constants-prefix "adok-" <BR> ) <BR> ;; </FONT>找不到时,则通知操作者<FONT face="Times New Roman"> <BR> (alert (strcat "</FONT>不能找到以下文件<FONT face="Times New Roman">\n" ADO_DLLPath "msado15.dll")) <BR> ) <BR> ) <BR> ) <BR>) <BR><BR><BR>;</FONT>生成<FONT face="Times New Roman">MS-Access </FONT>或<FONT face="Times New Roman"> MS-SQL Server </FONT>数据库的连接字符串<FONT face="Times New Roman"> <BR>;;;****************************************************************** <BR>;;; </FONT>使用<FONT face="Times New Roman">ODBC(</FONT>不需要<FONT face="Times New Roman">DSN)</FONT>连接<FONT face="Times New Roman">MS-Access</FONT>数据库<FONT face="Times New Roman"> <BR>;;; </FONT>示例:<FONT face="Times New Roman"> (DbConnect_MSAccess1 "d:/dbfiles/products.mdb") <BR>;;;****************************************************************** <BR><BR>(defun DbConnect_MSAccess1 (dbFile) <BR> (strcat <BR> "Provider=MSDASQL;" <BR> "Driver={Microsoft Access Driver (*.mdb)};" <BR> "DBQ=" dbFile <BR> ) <BR>) <BR><BR>;</FONT>从内存中释放<FONT face="Times New Roman">VLA</FONT>对象<FONT face="Times New Roman"> <BR>(defun MxRelease (xObject) <BR> vlax-object-released-p <BR> (if (not (vlax-object-released-p xObject)) <BR> (vlax-Release-Object xObject) <BR> ) <BR>) <BR><BR>;</FONT>关闭<FONT face="Times New Roman">ADO Connection </FONT>对象并将内存释放出来<FONT face="Times New Roman"> <BR>(defun DbCloseConnection (dbConnObject) <BR> (vlax-Invoke-Method dbConnObject "Close") <BR> (MxRelease dbConnObject) <BR>) <BR><BR>;</FONT>关闭<FONT face="Times New Roman">ADO RecordSet</FONT>对象并将内存释放出来<FONT face="Times New Roman"> <BR>(defun DbCloseRecordset (rsObject) <BR> (vlax-Invoke-Method rsObject "Close") <BR> (MxRelease rsObject) <BR>) <BR><BR>;</FONT>布尔测试<FONT face="Times New Roman">RecordSet </FONT>是否为<FONT face="Times New Roman"> Closed (T </FONT>或<FONT face="Times New Roman"> nil) <BR>(defun DbRsIsClosed (rsObject) <BR> (= adok-adStateClosed (vlax-Get-Property rsObject "State")) <BR>) <BR><BR>;</FONT>返回一个<FONT face="Times New Roman">ADO RecordSet</FONT>对象中的记录数<FONT face="Times New Roman"> <BR>(defun DbRsCount (rsObject) <BR> (vlax-Get-Property rsObject "RecordCount") <BR>) <BR><BR>;</FONT>返回<FONT face="Times New Roman">Field</FONT>对象中给定字段数的字段名称<FONT face="Times New Roman"> <BR>(defun DbGetFields (fObject fCount / FieldNumber) <BR> (setq FieldNumber -1) <BR> (while (> fCount (setq FieldNumber (1+ FieldNumber))) <BR> (setq FieldList (cons (vlax-Get-Property (DbRsFieldItem FieldsObject FieldNumber) "Name") FieldList)); setq <BR> ); end while <BR>); defun <BR><BR>;</FONT>从<FONT face="Times New Roman">RecordSet</FONT>对象返回<FONT face="Times New Roman">ADO Field</FONT>对象<FONT face="Times New Roman"> <BR>(defun DbRsFields (rsObject) <BR> (vlax-Get-Property rsObject "Fields") <BR>) <BR><BR>;</FONT>返回给定<FONT face="Times New Roman">Field</FONT>对象的字段数量<FONT face="Times New Roman"> <BR>(defun DbRsFieldCount (fObject) <BR> (vlax-Get-Property fObject "Count") <BR>) <BR><BR>;</FONT>获取<FONT face="Times New Roman">Field</FONT>对象的字段名<FONT face="Times New Roman">(</FONT>项<FONT face="Times New Roman">) <BR>(defun DbRsFieldItem (fObject fNumber) <BR> (vlax-Get-Property fObject "Item" fNumber) <BR>) <BR><BR>;</FONT>返回<FONT face="Times New Roman">RecordSet</FONT>对象的<FONT face="Times New Roman">RowSet</FONT>对象<FONT face="Times New Roman"> <BR>(defun DbRsGetRows (rsObject) <BR> (vlax-Invoke-Method rsObject "GetRows" adok-adGetRowsRest) <BR>) <BR><BR>;</FONT>应用一个<FONT face="Times New Roman">ADO LOCK(</FONT>锁定<FONT face="Times New Roman">)</FONT>类型到给定的<FONT face="Times New Roman">RecordSet</FONT>对象<FONT face="Times New Roman"> <BR>(defun DbRsLockType (rsObject lockType) <BR> (cond <BR> ( (= (strcase lockType) "OPTIMISTIC") <BR> (vlax-Put-Property rsObject "LockType" adok-adLockOptimistic) <BR> ) <BR> ( (= (strcase lockType) "BATCHOPTIMISTIC") <BR> (vlax-Put-Property rsObject "LockType" adok-adLockBatchOptimistic) <BR> ) <BR> ( (= (strcase lockType) "READONLY") <BR> (vlax-Put-Property rsObject "LockType" adok-adLockReadOnly) <BR> ) <BR> ) <BR>) <BR><BR>(defun Search(RSObject / lst FieldsObject FieldCount FieldList ReturnValue) <BR> (defun getlst (var) <BR> (setq lst nil) <BR> (setq n (length var) i 0) <BR> (while (< i n) <BR> (setq lst (append lst (list (vlax-variant-value (nth i var))))) <BR> (setq i (1+ i)) <BR> ) <BR> lst <BR> ) <BR> (setq FieldsObject (DbRsFields RSObject) ;; </FONT>将字段作为对象<FONT face="Times New Roman"> <BR> FieldCount (DbRsFieldCount FieldsObject) ;; </FONT>取得列的数量<FONT face="Times New Roman"> <BR> FieldList (DbGetFields FieldsObject FieldCount) ;; </FONT>取得列表中所有列的名称<FONT face="Times New Roman"> <BR> ReturnValue (list (reverse FieldList))) ; setq <BR> (setq lst (vlax-safearray->list (vlax-variant-value (dbrsgetrows rsobject)))) <BR> (setq lst (mapcar 'getlst lst)) <BR> (setq lst (mapcar '(lambda(var1 var2) (append (list var1) (list var2))) (car returnvalue) lst)) <BR> (print lst) <BR>) <BR><BR>;A sample... <BR>(defun c:test (/ getlst dbconnection rsobject SqlString) <BR> (DbInitADO) ;</FONT>初始化<FONT face="Times New Roman"> <BR> (setq DBConnection (vlax-create-object "adodb.connection")) ;</FONT>创建并返回<FONT face="Times New Roman">ADO Connection</FONT>对象<FONT face="Times New Roman"> <BR> (setq RSObject (vlax-create-object "adodb.recordset")) ;</FONT>创建并返回<FONT face="Times New Roman">ADO RecordSet</FONT>对象<FONT face="Times New Roman"> <BR> (setq SqlString "select </FONT>点号<FONT face="Times New Roman">,</FONT>横坐标<FONT face="Times New Roman">,</FONT>纵坐标<FONT face="Times New Roman">,</FONT>井盖高<FONT face="Times New Roman"> from pspoint") <BR> (vlax-invoke-method DBConnection "open" (DbConnect_MSAccess1 "e:\\AAA.mdb") "admin" "" adok-adConnectUnspecified) <BR> (vlax-invoke-method RSObject "open" SqlString DBConnection nil nil adok-adcmdtext) <BR> (search rsobject) <BR> (DbCloseRecordset rsobject) <BR> (DbCloseConnection dbconnection) <BR> (princ) <BR>) <BR><BR></FONT> <A href="mailto:meflying@mjtd.com" target="_blank" ><FONT face="Times New Roman" color=#000000>meflying@mjtd.com</FONT></A><FONT face="Times New Roman"> <BR></FONT> <FONT face="Times New Roman">2004-10-10</FONT><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></P>
<P>能不能给个写进ACCESS数据库的例子吗,谢谢了,</P>
<P> </P>
abiao
发表于 2006-5-30 23:59:00
感动啊
页:
1
2
[3]
4
5
6
7
8
9
10