// ==================================================================== /// /// Пишем в лог поисковых запросов. /// **** ПИШЕМ В БД MSSQL /// static void DoSearchLog ( TransactionInfo transaction, RequestInfo request, ResponseInfo response ) { try { if ((( request.Command1 != "K" ) || ( request.Workstation != "R") || ( transaction.Stage != 13 )) && (BibSigla>0 && BibSigla<22)) { return; } using (StreamWriter writer = new StreamWriter ( GetTodayFile ( SearchLogFileName ), true )) { /* writer.WriteLine ( "{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}", transaction.Index, // Порядковый номер транзакции transaction.Moment, // Момент начала транзакции transaction.EndPoint, // Адрес клиента request.Username, // Логин пользователя transaction.IrbisDuration, // Длительность обработки команды response.ReturnCode, // Код возврата SafeGet ( request.Lines, 0 ), // База данных SafeGet ( request.Lines, 1 ), // Поисковое выражение SafeGet ( request.Lines, 2 ), // Число запрашиваемых записей SafeGet ( request.Lines, 3 ), // Номер первой возвращаемой записи SafeGet ( response.Lines, 1 ) // Количество найденных );*/ } using (SqlConnection con = new SqlConnection("СТРОКА ПОДКЛЮЧЕНИЯ")) { con.Open(); SqlCommand Cmd = con.CreateCommand(); Cmd.CommandText = "EXEC dbo.pSEARCHLOG_WRITE " + "@Index="+transaction.Index + "," + "@Moment='" + transaction.Moment + "',@SIG="+BibSigla+"," + "@EndPoint='" + transaction.EndPoint + "'," + "@Username='" + request.Username + "'," + "@IrbisDuration=" + transaction.IrbisDuration + "," + "@ReturnCode=" + response.ReturnCode + "," + "@DB='" + SafeGet(request.Lines, 0) + "'," + "@SearchTerm='" + SafeGet(request.Lines, 1) + "'," + "@ReqRec=" + SafeGet(request.Lines, 2) + "," + "@FirstRecNum=" + SafeGet(request.Lines, 3) + "," + "@SearchRecNum=" + SafeGet(response.Lines, 1) + ";"; Cmd.ExecuteNonQuery(); // con.Close(); } } catch ( Exception ex ) { WriteException(ex); Debug.WriteLine ( ex ); } } // ====================================================================