excel - Connecting to Redshift SQL Server with VBA -
i'm having trouble connecting redshift sql server (postgres) vba macro.
edit: here's error i'm getting:
-2147467259 microsoft ole db provider odbc drivers [microsoft][odbc driver manager] data source name not found , no default driver specified c:\progra~1\common~1\micros~1\vba\vba7.1\1033\vblr6.chm 1000440
also, commented out of code while trouble shooting. public conn1 adodb.connection public conn2 adodb.connection public function openconnection1() boolean
dim boolstate boolean dim servername string, databasename string, _ username string, password string on error goto errorhandler if conn1 nothing set conn1 = new adodb.connection end if if conn1.state = adstateopen boolstate = true goto exithere else ' put text box values connection variables. servername = "asdf" databasename = "asdf" ' specify ole db provider. 'conn1.provider = "sqloledb" ' set sqloledb connection properties. 'conn1.properties("data source").value = servername 'conn1.properties("initial catalog").value = databasename 'conn1.properties("network library").value = "dbmssocn" ' decision code login authorization type: ' windows nt or sql server authentication. conn1.properties("connect timeout").value = 3 ' open database. conn1.properties("user id").value = "asdf" conn1.properties("password").value = "asdf" 'conn1.properties("trusted_connection") = false 'conn1.properties("integrated security").value = "sspi" conn1.open exithere: if conn1.state = adstateopen boolstate = true else boolstate = false end if end if openconnection1 = boolstate exit function errorhandler: openconnection1 = false msgbox "the application failed connect sql database." debug.print err.number, err.source, err.description, err.helpfile, err.helpcontext resume exithere end function
Comments
Post a Comment