diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 8a2b2752a1e89eecb3cc7b3f7ca8442b7e0332ec..72349c8fba397207ebe0b06633f435a379813a12 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -205,7 +205,9 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, } else { printf("connect failed, reason: %s.\n\n", tstrerror(terrno)); } + int32_t lastError = terrno; taos_free_result(pSql); + if (terrno != lastError) terrno = lastError; taos_close(pObj); return NULL; }