<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: MDB data to Object Data in AutoCAD Map 3D Developer Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370392#M3774</link>
    <description>LochDhu,&lt;BR /&gt;
&lt;BR /&gt;
That's a useful and good idea.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu</description>
    <pubDate>Thu, 21 Jul 2005 03:40:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-07-21T03:40:05Z</dc:date>
    <item>
      <title>MDB data to Object Data</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370384#M3766</link>
      <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
Do any one know how to get MDB data as object data on the basis of a link, with the fields available in the object data table?&lt;BR /&gt;
&lt;BR /&gt;
Please let me know of any such possibilities.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu</description>
      <pubDate>Mon, 04 Jul 2005 12:18:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370384#M3766</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-04T12:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: MDB data to Object Data</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370385#M3767</link>
      <description>We use OD to hold an ID that is used to retrieve data from an Access database.  Is that what you are looking for?  Or do you want to assign object data to an object automatically by connecting it to a database so the object data changes with the database changes?&lt;BR /&gt;
&lt;BR /&gt;
Bart</description>
      <pubDate>Tue, 12 Jul 2005 17:54:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370385#M3767</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-12T17:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: MDB data to Object Data</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370386#M3768</link>
      <description>Bart,&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt;&amp;gt;&amp;gt;Or do you want to assign object data to an object automatically by connecting it to a database so the object data changes with the database changes?&lt;BR /&gt;
&lt;BR /&gt;
Yes.This is my requirement.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Alternatively, is it possible that I have blank object data fields and fields by similar name in an MDB table.&lt;BR /&gt;
Using a link, can I tranfer the values from MDB to Object data table?&lt;BR /&gt;
Is this possible?&lt;BR /&gt;
&lt;BR /&gt;
Thanks You,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu</description>
      <pubDate>Wed, 13 Jul 2005 09:00:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370386#M3768</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-13T09:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: MDB data to Object Data</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370387#M3769</link>
      <description>I would think it very possible.  It would require a degree of automation though.  I use VBA code and the ADO connection object to connect my Maps to an Access database.  I know that you can create a Link Template in MAP, but I don't know how that works, however there any number of people in the group who could help you with that.  &lt;BR /&gt;
I would think that you would need to assign a unique Key to each object that would be a record id in the database.  Then you would need to write a routine that was either fired mannually by the user, called on startup or fired using a VB timer control, to connect to the Database and check for updates.  I don't think that there is a way to link the drawing objects so that changes in the database happen as the affect  the drawing objects instantly.&lt;BR /&gt;
If you would like help with the ADO connection to the Database please let me know and I will be happy to share the code we use.&lt;BR /&gt;
&lt;BR /&gt;
EDIT: To answer the other question, yes OD fields can be blank, and the fields in the database can be blank so long as the are not "required".&lt;BR /&gt;
&lt;BR /&gt;
Bart

Message was edited by: bart1123</description>
      <pubDate>Wed, 13 Jul 2005 13:38:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370387#M3769</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-13T13:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: MDB data to Object Data</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370388#M3770</link>
      <description>Hi Bart,&lt;BR /&gt;
&lt;BR /&gt;
Thanks for your views.&lt;BR /&gt;
I request you share the code the performs ADO connection to the Database which would help me to move a step ahead on this issue.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu</description>
      <pubDate>Thu, 14 Jul 2005 03:58:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370388#M3770</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-14T03:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: MDB data to Object Data</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370389#M3771</link>
      <description>MNRaghu, &lt;BR /&gt;
Below is the code that I use to open and close the ADO object to connect to the database.  Following that is the code that prompts the user for a selection on screen, checks for Object Data and reads the OD if found.  While this does not show how to write data from the database to the OD I hope that it is enough to give you a good primer on where to look.  By the way this function was written entirely  from the help files in Map on ActiveX autoation and API help.  &lt;BR /&gt;
I hope this helps you.&lt;BR /&gt;
&lt;BR /&gt;
Bart&lt;BR /&gt;
***************************BEGIN CODE***********************&lt;BR /&gt;
'---------------------------------------------------------------------------------------&lt;BR /&gt;
' Module    : modDataBase&lt;BR /&gt;
' DateTime  : 6/3/2005 10:29&lt;BR /&gt;
' Author    : bart&lt;BR /&gt;
' Purpose   :This holds the Database connection string and deals with opening and _&lt;BR /&gt;
closing the connection&lt;BR /&gt;
'---------------------------------------------------------------------------------------&lt;BR /&gt;
Option Explicit&lt;BR /&gt;
Dim sConn       As String&lt;BR /&gt;
Public oConn    As ADODB.Connection&lt;BR /&gt;
'Make sure you have a reference in the project to MS Active Data Objects 2.x (I use 2.8)&lt;BR /&gt;
&lt;BR /&gt;
Public Sub OpenDB&lt;BR /&gt;
Set oConn = New ADODB.Connection&lt;BR /&gt;
&lt;BR /&gt;
    sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyData\Database.mdb;" &amp;amp; _&lt;BR /&gt;
            "Persist Security Info=False"&lt;BR /&gt;
oConn.Open sConn&lt;BR /&gt;
&lt;BR /&gt;
Exit Sub&lt;BR /&gt;
CheckError:&lt;BR /&gt;
    MsgBox "Database Connection Error" &amp;amp; vbCrLf &amp;amp; Err.Number &amp;amp; " - " &amp;amp; Err.Description&lt;BR /&gt;
    'LocErr = True&lt;BR /&gt;
    Exit Sub&lt;BR /&gt;
    Resume Next&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Public Sub CloseDB()&lt;BR /&gt;
If oConn.State = 1 Then&lt;BR /&gt;
    oConn.Close&lt;BR /&gt;
    Set oConn = Nothing&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The following code prompts the user to select an object with Object Data Attached, reads the value of the object data and querries the database for records matching the value of the Object Data&lt;BR /&gt;
&lt;BR /&gt;
Public NEW_TLNUM        As String&lt;BR /&gt;
Public rsCable          As ADODB.Recordset&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Public Sub GetCableID()&lt;BR /&gt;
    Dim ODrcs As ODRecords&lt;BR /&gt;
&lt;BR /&gt;
        Dim boolVal As Boolean&lt;BR /&gt;
        &lt;BR /&gt;
        Dim returnObj As AcadObject&lt;BR /&gt;
        &lt;BR /&gt;
        Dim basePnt As Variant&lt;BR /&gt;
        &lt;BR /&gt;
        Dim i As Integer&lt;BR /&gt;
        Dim answer As Variant&lt;BR /&gt;
      On Error GoTo errorhandler&lt;BR /&gt;
       '**********************************NEW****************&lt;BR /&gt;
               Dim amap As Object&lt;BR /&gt;
        Dim ODfdfs As ODFieldDefs&lt;BR /&gt;
        Dim ODfdf As ODFieldDef&lt;BR /&gt;
        Dim ODtb As ODTable&lt;BR /&gt;
        Dim ODrc As ODRecord&lt;BR /&gt;
        &lt;BR /&gt;
        Set amap = ThisDrawing.Application. _&lt;BR /&gt;
        GetInterfaceObject("AutoCADMap.Application.2")&lt;BR /&gt;
                 Set ODfdfs = amap.Projects(ThisDrawing).MapUtil.NewODFieldDefs&lt;BR /&gt;
        &lt;BR /&gt;
        ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"&lt;BR /&gt;
        If returnObj.ObjectName = "AcDbBlockReference" Then&lt;BR /&gt;
            GetNodePic returnObj.Handle&lt;BR /&gt;
            Exit Sub&lt;BR /&gt;
        End If&lt;BR /&gt;
        &lt;BR /&gt;
         &lt;BR /&gt;
&lt;BR /&gt;
' Add Column Headings and Defaults&lt;BR /&gt;
 Set ODfdf = ODfdfs.Add("CAB_ID", "Cab Disc", "23", 0)&lt;BR /&gt;
Set ODfdf = ODfdfs.Add("Route_ID", "Rout Disc", "66", 1)&lt;BR /&gt;
&lt;BR /&gt;
        &lt;BR /&gt;
        Set ODrcs = amap.Projects.Item(ThisDrawing). _&lt;BR /&gt;
        ODTables.Item("CABLE").GetODRecords&lt;BR /&gt;
        &lt;BR /&gt;
&lt;BR /&gt;
        &lt;BR /&gt;
        'Prompt user to select an object&lt;BR /&gt;
        &lt;BR /&gt;
 &lt;BR /&gt;
        &lt;BR /&gt;
        &lt;BR /&gt;
        boolVal = ODrcs.Init(returnObj, True, False)&lt;BR /&gt;
        &lt;BR /&gt;
        For i = 0 To ODrcs.Record.Count - 1&lt;BR /&gt;
        &lt;BR /&gt;
        NEW_TLNUM = ODrcs.Record.Item(i).Value&lt;BR /&gt;
        Next i&lt;BR /&gt;
        &lt;BR /&gt;
        '*****************GET CABLE******************&lt;BR /&gt;
            Const conErrInvalidNull = 94&lt;BR /&gt;
    Const conErrNotObject = 438&lt;BR /&gt;
    Const conErrNoRecord = 3021&lt;BR /&gt;
    &lt;BR /&gt;
   OpenDB 'open Connection&lt;BR /&gt;
    &lt;BR /&gt;
&lt;BR /&gt;
    Set rsCable = New ADODB.Recordset&lt;BR /&gt;
    sSQL = "Select * from CABLE where CAB_ID = '" &amp;amp; NEW_TLNUM &amp;amp; "'" 'build SQL query to find record based on Cable ID&lt;BR /&gt;
&lt;BR /&gt;
    On Error GoTo errorhandler&lt;BR /&gt;
    rsCable.Open sSQL, oConn, , adLockOptimistic  'Finds record in Database based on CAB_ID&lt;BR /&gt;
&lt;BR /&gt;
    If Not rsCable.EOF Then 'If record is found then load record into form&lt;BR /&gt;
        Load frmCable &lt;BR /&gt;
        frmCable.Show&lt;BR /&gt;
        Exit Sub&lt;BR /&gt;
    End If&lt;BR /&gt;
&lt;BR /&gt;
errorhandler:&lt;BR /&gt;
    Select Case Err&lt;BR /&gt;
        Case conErrNotObject&lt;BR /&gt;
            MsgBox ("This is not a cable."), vbExclamation&lt;BR /&gt;
        Case conErrInvalidNull&lt;BR /&gt;
            Resume Next&lt;BR /&gt;
        Case conErrNoRecord&lt;BR /&gt;
            Resume&lt;BR /&gt;
        Case Else&lt;BR /&gt;
            MsgBox ("Unexpected error :" &amp;amp; Err.Description), vbExclamation&lt;BR /&gt;
    End Select&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
********************************END CODE************************</description>
      <pubDate>Thu, 14 Jul 2005 14:40:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370389#M3771</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-14T14:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: MDB data to Object Data</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370390#M3772</link>
      <description>Bart,&lt;BR /&gt;
&lt;BR /&gt;
Thank a lot for sharing the code.&lt;BR /&gt;
&lt;BR /&gt;
That should be more than enough for me to proceed.&lt;BR /&gt;
&lt;BR /&gt;
Thanks again......&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu</description>
      <pubDate>Fri, 15 Jul 2005 03:44:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370390#M3772</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-15T03:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: MDB data to Object Data</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370391#M3773</link>
      <description>One way around customization is to export your data to a SHP - taking all the MDB data to SHP.  Then import the SHP into a new DWG and have it create Object Data during the import.</description>
      <pubDate>Wed, 20 Jul 2005 19:20:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370391#M3773</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-20T19:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: MDB data to Object Data</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370392#M3774</link>
      <description>LochDhu,&lt;BR /&gt;
&lt;BR /&gt;
That's a useful and good idea.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
MNRaghu</description>
      <pubDate>Thu, 21 Jul 2005 03:40:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/mdb-data-to-object-data/m-p/1370392#M3774</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-07-21T03:40:05Z</dc:date>
    </item>
  </channel>
</rss>

