tag:blogger.com,1999:blog-4036550325719404575.post8451423026873386365..comments2022-04-10T00:01:48.559-07:00Comments on What I need to know: Connecting to postgres from Excel (visual basic)George DeWolfhttp://www.blogger.com/profile/04838690888556131844noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-4036550325719404575.post-75710517495035984122022-03-03T10:19:32.718-08:002022-03-03T10:19:32.718-08:00Harrah's Cherokee Casino & Hotel - Mapyro
...Harrah's Cherokee Casino & Hotel - Mapyro<br />Harrah's Cherokee Casino & Hotel. 0.2 mi (0.3 km) <a href="https://www.jtmhub.com/%ec%96%91%ec%82%b0%ec%97%90-%eb%8c%80%ed%95%9c-%ec%9a%b0%ec%88%98%ed%95%9c%ec%b6%9c%ec%9e%a5%eb%a7%88%ec%82%ac%ec%a7%80%eb%a6%ac%eb%b7%b0.html/" rel="nofollow">양산 출장샵</a> from McCarran International <a href="https://www.mapyro.com/%ea%b3%a0%ec%96%91%ec%b6%9c%ec%9e%a5%ec%83%b5%ea%b0%80%ec%9d%b4%eb%93%9c.html/" rel="nofollow">고양 출장샵</a> Airport. 3.8 mi (4 km) from Harrah's Cherokee Casino. 2.2 <a href="https://drmcd.com/%eb%8f%99%ed%95%b4%ec%b6%9c%ec%9e%a5%ec%95%88%eb%a7%88.html/" rel="nofollow">동해 출장안마</a> mi <a href="https://drmcd.com/%eb%b3%b4%eb%a0%b9%ea%b0%80%ec%9e%a5-%ec%9d%b8%ea%b8%b0-%ec%9e%88%eb%8a%94%ec%b6%9c%ec%9e%a5%eb%a7%88%ec%82%ac%ec%a7%80%ea%b0%80%ea%b2%8c.html/" rel="nofollow">보령 출장마사지</a> (1 km) from <a href="https://www.mapyro.com/%ec%a0%9c%ec%a3%bc%eb%8f%84%ec%b5%9c%ec%83%81%ec%9d%98-%ea%b4%80%eb%a6%ac%ec%b6%9c%ec%9e%a5%ec%95%88%eb%a7%88.html/" rel="nofollow">제주도 출장마사지</a>pattisondaigneaulthttps://www.blogger.com/profile/18151804872991435133noreply@blogger.comtag:blogger.com,1999:blog-4036550325719404575.post-75371890497679518022011-12-12T06:50:51.216-08:002011-12-12T06:50:51.216-08:00I have solved the Excel to Postgres using VB conne...I have solved the Excel to Postgres using VB connection problem.<br />MS query is fine for doing reads from your database but it is sometimes usefull to write records from excel.<br /><br />Here for others to use is the macro..<br />Sub UpdateRecord()<br />Dim cnn As New ADODB.connection<br />Dim rst As New ADODB.Recordset<br />'dim cnn.ConnectionString string<br /><br />cnn.Open "Driver={PostgreSQL ODBC Driver(Unicode)};DSN=postgres;Server=localhost;Port=5432;UID=postgres;PWD=password; Database=postgres;" & _<br /> "READONLY=0;PROTOCOL=6.4;FAKEOIDINDEX=0;SHOWOIDCOLUMN=0;ROWVERSIONING=0;SHOWSYSTEMTABLES=1"<br /> <br />'dropTable = "DROP TABLE IF EXISTS nyse.blobtable"<br />'createTable = "CREATE TABLE nyse.blobtable (id INTEGER , myblob char(2), myBlobName VARCHAR(300))"<br />until<br />insertTable = "INSERT INTO nyse.customer" & _<br /> " VALUES (customer.number,customer.name,customer.addr1,customer.addr2,customer.city,customer.postalcode,customer.country)"<br /><br />' Execute queries and prepare blob writing<br /><br />dropResult = cnn.Execute(dropTable)<br />createResult = cnn.Execute(createTable)<br />insertResult = cnn.Execute(insertTable)<br /><br />cnn.Close<br /><br />End Sub<br /><br />I have used the add and drop table commands just to illustrate that you can do almost anything in the database from excel.George DeWolfhttps://www.blogger.com/profile/04838690888556131844noreply@blogger.comtag:blogger.com,1999:blog-4036550325719404575.post-74386652209249603812011-12-05T12:10:48.980-08:002011-12-05T12:10:48.980-08:00For whatever weird reason, your
"PWD=passwor...For whatever weird reason, your<br /><br />"PWD=password;"<br /><br />line got turned into a hyperlink with the contents<br /><br />mailto:PWD=!Q@aw3se4<br /><br />Ah...the @ sign. Microsoft copy and paste? Or some other?Pedahzurhttps://www.blogger.com/profile/08531020477517782226noreply@blogger.comtag:blogger.com,1999:blog-4036550325719404575.post-63167089991402245042011-12-03T10:53:29.414-08:002011-12-03T10:53:29.414-08:00Did you try connecting to the Postgres database vi...Did you try connecting to the Postgres database via Excel's get external data, data source GUI and/or, as Regina commented, creating a datasource that connects to the database? I haven't used the VBA approach but I've used the former to get PostgreSQL query results into Excel for charting. I haven't used VBA because there's a lot more functionality available in PostgreSQL queries and procedures.Jimhttps://www.blogger.com/profile/00293431176675954707noreply@blogger.comtag:blogger.com,1999:blog-4036550325719404575.post-19783609922560588202011-12-03T07:31:44.562-08:002011-12-03T07:31:44.562-08:00Your DSN is wrong. But you knew that. You are us...Your DSN is wrong. But you knew that. You are using the ODBC driver and the DSN refers to the name you registered your PostgreSQL data source in ODBC manager (not the PostgreSQL server).<br /><br />So if you registered it as MyLocalPgServer, then that would be what you use for DSNReginahttps://www.blogger.com/profile/02362828062351573391noreply@blogger.com