PDA

Click to See Complete Forum and Search --> : updating database via ODBC


carolyn
Feb 22nd, 2000, 12:41 PM
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

JHausmann
Feb 23rd, 2000, 01:49 AM
You should be able to do it the old-fashioned way:



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