Announcement

Collapse
No announcement yet.

How create workgroup file (.MDW) with ADO (MS Jet)?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How create workgroup file (.MDW) with ADO (MS Jet)?

    Hello,
    I'm looking for a way to create a new workgroup file System.mdw with ADO.
    To create database I use following:
    Code:
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "WIN32API.INC" 
    #INCLUDE "adodb.inc"      ' created with PowerBASIC COM Browser" from
                              ' Microsoft ActiveX Data Objects 2.7 Library
    
    FUNCTION PBMAIN () AS LONG
    
    DIM oCon AS ADODBConnection
    DIM vSQL AS VARIANT
    
    SET oCon = NEW ADODBConnection IN "ADOX.Catalog"
    IF OBJRESULT OR ERR THEN
      MSGBOX "Error in ADODB.Connection" & $CRLF & _
      "Object Result = " & STR$(OBJRESULT) & ";" & $CRLF & _
      "ERR = " & STR$(ERR) & "."
      EXIT FUNCTION
    END IF
    
    ' Engine Type=5 for Access 2000 Database
    LET vSQL = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\PBWin80\MyWork\SQL\my_new_db.mdb;Jet OLEDB:Engine Type=5;"
    
    OBJECT CALL oCon.Execute(vSQL)
    IF OBJRESULT OR ERR THEN
      MSGBOX "Error by create database" & $CRLF & _
      "Object Result = " & STR$(OBJRESULT) & ";" & $CRLF & _
      "ERR = " & STR$(ERR) & "."
      EXIT FUNCTION
    END IF
    
    MSGBOX "OK!"
    
    END FUNCTION
    I will be greatful if there is anybody who can help me.
    Yours sincerely

  • #2
    I found a solution:
    Code:
    FUNCTION PBMAIN () AS LONG
    
    DIM oCon AS ADODBConnection
    DIM vSQL AS VARIANT
    
    SET oCon = NEW ADODBConnection IN "ADOX.Catalog"
    IF OBJRESULT OR ERR THEN
      MSGBOX "Error in ADODB.Connection" & $CRLF & _
      "Object Result = " & STR$(OBJRESULT) & ";" & $CRLF & _
      "ERR = " & STR$(ERR) & "."
      EXIT FUNCTION
    END IF
    
    ' Engine Type=5 for Access 2000 Database
    LET vSQL = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=C:\PBWin80\MyWork\SQL\my_new_wg.mdw;Jet OLEDB:Create System Database=-1"
    
    OBJECT CALL oCon.Execute(vSQL)
    IF OBJRESULT OR ERR THEN
      MSGBOX "Error by create workgroup" & $CRLF & _
      "Object Result = " & STR$(OBJRESULT) & ";" & $CRLF & _
      "ERR = " & STR$(ERR) & "."
      EXIT FUNCTION
    END IF
    
    MSGBOX "OK!"
    
    END FUNCTION
    Yours sincerely

    Comment

    Working...
    X