这组命令无法按原样运行:
class Fisiere_Intrare
{
public:
void Fisiere_Angajati()
{
ifstream fis;
fis.open("Angajat.txt", ifstream::in);
if (fis.is_open())
{
while (!fis.eof())
{
Angajat a;
fis >> a;
cout << a;
}
}
fis.close();
}
};
它完全忽略-C参数并在/ home / git / gitlab / git-data / repositories中创建文件。我做错了什么?
答案 0 :(得分:1)
-C标志不指定输出目录。您需要在指定存档文件的位置执行此操作。所以,你的命令可能变成:
Sub Get_Data()
Application.ScreenUpdating = False
Load frmDealers
frmDealers.Show
Startdate = CalSelDate1
Enddate = CalSelDate2
Dim MyGroup As String
MyGroup = ""
MyGroup = Cells(5, 6)
HowMany = 0
Got1 = False
Got2 = False
GotUS = False
GotCN = False
If Startdate <> "12:00:00 AM" And Enddate = "12:00:00 AM" Then Got1 = True
If Startdate <> "12:00:00 AM" And Enddate <> "12:00:00 AM" Then Got2 = True
If UCase(Mid(MyGroup, 1, 1)) = "C" Then
GotCN = True
Else
GotUS = True
End If
Dim Connection As New ADODB.Connection
Dim RecSet1 As ADODB.Recordset
Dim Recset2 As ADODB.Recordset
Dim vsql As String
Dim NoRecs1 As Boolean
Dim NoRecs2 As Boolean
Dim r As Integer
Dim MyRow As Integer
Dim MyUnit As String
vsql = ""
NoRecs1 = False
NoRecs2 = False
r = 6
MyRow = 2
MyUnit = ""
Set Connection = New ADODB.Connection
Connection.ConnectionString = ConnectionString
Connection.Open
Do Until Len(Trim(Cells(r, 2))) = 0
Cells(r, 2) = UCase(Cells(r, 2))
MyUnit = ""
MyUnit = Cells(r, 2)
Application.StatusBar = "Retrieving data for unit number: " & MyUnit
If Got1 = True And GotUS = True Then
vsql = "SELECT…….
End If
If Got1 = True And GotCN = True Then
vsql = "SELECT………….
End If
If Got2 = True And GotUS = True Then
vsql = "SELECT……………
End If
If Got2 = True And GotCN = True Then
vsql = "SELECT………….
End If
Set RecSet1 = Connection.Execute(vsql, dbrows, adCmdText)
' archive table
If Got1 = True And GotUS = True Then
vsql = "SELECT…………
End If
If Got1 = True And GotCN = True Then
vsql = "SELECT…………..
End If
If Got2 = True And GotUS = True Then
vsql = "SELECT…………
End If
If Got2 = True And GotCN = True Then
vsql = "SELECT…………
End If
'''' ERROR OCCURS on this line
Set Recset2 = Connection.Execute(vsql, dbrows, adCmdText)
'…other code
NoRecs1 = False
NoRecs2 = False
Worksheets("Macros").Activate
r = r + 1
Loop
Cells(1, 1).Select
Connection.Close
Set RecSet1 = Nothing
Set Recset2 = Nothing
''' other code to format data
Application.ScreenUpdating = True
End Sub