Question:
How can I insert a record into a PostgreSQL Database?
Solution:
To do so, you must create the connection via scripts, since this Database is not native to E3. For example:
‘Creates the connection to the database
Set db_con = CreateObject(“ADODB.Connection”)
Set db_con = CreateObject(“ADODB.Connection”)
str_con = “Driver={PostgreSQL ODBC Driver(ANSI)};Server=localhost;Port=5432;Database=postgres;Uid=postgres;Pwd=Abcd1234”
db_con.Open str_con
‘Creates the recordset
Set rs = CreateObject(“ADODB.Recordset”)
rs.Source = “INSERT INTO tabelateste3 VALUES (‘1/1/1958’, ‘0’)”
rs.ActiveConnection = db_con
rs.CursorType = 1 ‘adOpenKeyset
rs.LockType = 3 ‘adLockOptimistic
rs.Open
NOTE: for this example, consider this table as having already been created in the Database.