I'm trying to connect to a postgres database with adodb so that to get data within a recordset and then update this data.
On postgres side :
create table test (description varchar) ;
I establish the connection to the database :
dim test_conn As ADODB.Connection
dim test_str As String
Set test_conn = New ADODB.Connection
If test_conn.State = 0 Then
test_str = "PROVIDER=MSDASQL.1;DSN=PostgreSQL35W" _
& ";DATABASE=database_name" _
& ";SERVER=database_server" _
& ";PORT=database_port" _
& ";UID=user_name" _
& ";PWD=user_pwd"
test_conn.CursorLocation = adUseServer
test_conn.Mode = adModeReadWrite
test_conn.Open test_str
End If
Then I open the recordset :
Dim test As ADODB.Recordset
Set test = New ADODB.Recordset
test.Open "select * from test", test_conn, adOpenDynamic, adLockOptimistic, adCmdText
Then I check if the recorset is updateable :
test.Supports(adAddNew) => True
test.Supports(adUpdate) => True
test.Supports(adDelete) => True
But when I try to add a new row in the recordset :
test.AddNew "description", "test_descr"
I systematically get the error :
Run-time error '-2147217887 (80040e21)':
Multiple-step operation generated errors. Check each status value.
Do you know where I'm wrong / I missed something ?