Results 1 to 2 of 2

Thread: updating database via ODBC

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Location
    Australia
    Posts
    115

    Post

    I'm using VB5 SP3 connecting to postgres database via ODBC.

    I'm selecting record into a RecordSet as dynasets, but the RecordSet's Updatable property is FALSE even thought I've set the read only property of the ODBC driver on my PC to false and grant all permissions to public on that table.

    How can I update this record set (insert, delete and update)? Or are there any more settings i need to do to be able to update this record set?

    TIA.

    Carolyn


  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    You should be able to do it the old-fashioned way:


    Code:
    Set g_Db = Workspaces(0).OpenDatabase("", False, False, ODBC1_str)
    Qry = "delete from table where condition"
    g_Db.Execute Qry, dbSQLPassThrough
    g_Db.Close
    
    
    _OR_
    
    
    
    Set conMain = g_DB.OpenConnection("ODBC string goes here")
    Set qdfTemp = conMain.CreateQueryDef("")
    
    
    _INSERT_
    
    With qdfTemp
       .Prepare = dbQUnprepare
       .SQL = "insert into table values('" & "variables to insert here" & "') "
       .Execute
    End With
    
    _UPDATE_
    
    With qdfTemp
       .Prepare = dbQUnprepare
       .SQL = "update table set value='" & variable "' " & _
          "where condition='" & variable & "'"
       .Execute
    end with

    Edited by JHausmann on 02-23-2000 at 02:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width