вот мой код :
- Код: Выделить всё
Sub rec_GKPZ(con As ADODB.Connection)
Dim T_start As String
Dim T_end As String
Dim A_start As String
Dim A_end As String
Dim rst As ADODB.Recordset
Dim MSP As MSProject.Application
Const AllStation = "Все станции"
Dim ErrCode As Integer
Dim msg As String
Dim msgType As Integer
Dim cmd As ADODB.Command
Dim cpr As ADODB.Parameter
Set MSP = New MSProject.Application
UsernmPrServ = MSP.UserName
Set cmd = New ADODB.Command
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "repGKPZ"
Set cpr = cmd.CreateParameter("@login_name", adVarChar, adParamInput, [255], UsernmPrServ)
cmd.Parameters.Append cpr
Set cpr = cmd.CreateParameter("@Msg", adVarChar, adParamInputOutput, [255], msg)
cmd.Parameters.Append cpr
Set cpr = cmd.CreateParameter("@MsgType", adInteger, adParamInputOutput, [10], msgType)
cmd.Parameters.Append cpr
Set cpr = cmd.CreateParameter("@ErrCode", adInteger, adParamInputOutput, [10], ErrCode)
cmd.Parameters.Append cpr
Set rst = New ADODB.Recordset
With frm1
If CB_Podrazd.Text = "Все станции" Then
sqlstring = sqlstring & "NULL ,"
Set cpr = cmd.CreateParameter("@station", adVarChar, adParamInput, [20])
cmd.Parameters.Append cpr
Else
office = CB_Podrazd.Text
sqlstring = sqlstring & " '" & office & "', "
Set cpr = cmd.CreateParameter("@station", adVarChar, adParamInput, [20], CB_Podrazd.Text)
cmd.Parameters.Append cpr
End If
Checkdate1 = False
Checkdate2 = False
If (Not DTP_R_New_click) And (Not DTP_R_New_Sel) Then
sqlstring = sqlstring & "NULL ,"
Set cpr = cmd.CreateParameter("@tender_start", adDate, adParamInput)
cmd.Parameters.Append cpr
Else
T_start = Format$(DTP_Razmesh_new.Value, "yyyy-mm-dd")
Set cpr = cmd.CreateParameter("@tender_start", adDate adParamInput, [], T_start)
cmd.Parameters.Append cpr
End If
End With
cmd.ActiveConnection = con' Con это connection уже настроенное, и в данный момент подключенный к базе, ждет выполнения запроса
Set rst = cmd.Execute
If office <> "Все станции" Then
Proc_one_station rst, con
Else
Proc_All_Station rst, con, cmd
End If
frm1.Hide
exithere:
Exit Sub
NOOFFICE:
MsgBox (NO_Office)
Exit Sub
NODATE:
MsgBox No_date
Exit Sub
OLDDATE:
MsgBox Old_date
Exit Sub
End Sub
при попытке выполнить получаю следующую ошибку
run-time error '-2147217887 (80040e21)': [Microsoft][ODBC SQL Server Drivers]:
Дополнительная возможность не реализована