Hỏi về ODBC ???
Em xin chào các anh chị GPE, em có tạo kết nối ODBC đến Server, đoạn code như sau:
Em muốn đưa dữ liệu được lấy về vào một mảng do em đã tạo trước, chứ không muốn xổ xuống Sheet như câu lệnh
estination:=Sheet1.Range("a1")
Mọi người có thể giúp em được không?
Em xin cảm ơn!
Em xin chào các anh chị GPE, em có tạo kết nối ODBC đến Server, đoạn code như sau:
Mã:
Sheet1.Range("a1:z100").ClearApplication.ScreenUpdating = False
varConn = "ODBC;DSN=Manufacturing;DATABASE=man;SERVER=172.16.32.5;PORT=5432;UID=nisticaUser;;SSLmode=disable;ReadOnly=0;Protocol=7.4;FakeOidInde"
slect = "select "
slect = slect & "sort_wo,unlabeled_sn, unlabeled_part, sp_get_latest_data_value(unlabeled_id, 'FAS_PreSplice_WorstLoss_AP1'),sp_get_latest_data_value(unlabeled_id, 'FAS_PreSplice_WorstLoss_AP2'),"
slect = slect & "sp_get_latest_data_value(unlabeled_id, 'FAS_PreSplice_WorstLoss_BP1'),sp_get_latest_data_value(unlabeled_id, 'FAS_PreSplice_WorstLoss_BP2'),"
from = " from "
from = from & "work_order_tracking_framework_extended as w" 'not exist ","
whe = " where "
whe = whe & "sort_wo::text = '" & a_wo & "' order by sort_wo Asc;"
SQL = slect & from & whe
With Sheet1.QueryTables.Add(Connection:=varConn, Destination:=Sheet1.Range("a1"), SQL:=SQL)
.RefreshStyle = xlOverwriteCells
.Refresh
End With
Application.CalculateUntilAsyncQueriesDone

Mọi người có thể giúp em được không?
Em xin cảm ơn!
Lần chỉnh sửa cuối: