<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS поиск в Recordset]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9461&amp;type=atom" />
	<updated>2014-04-07T11:20:53Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9461</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS поиск в Recordset]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81556#p81556" />
			<content type="html"><![CDATA[<p>Спс <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" />)</p>]]></content>
			<author>
				<name><![CDATA[inock]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25049</uri>
			</author>
			<updated>2014-04-07T11:20:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81556#p81556</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS поиск в Recordset]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81547#p81547" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Есть набор записей.</p></blockquote></div><p>Откуда он берётся?</p><p><em>Update:</em> Если извне — используйте условия в запросе SQL. Если, как в примере, формируется «ручками» — свойство «.Filter». И там, и там результат — в свойстве «.RecordCount».<br /></p><div class="codebox"><pre><code>Option Explicit

Const adFilterNone = 0

With WScript.CreateObject(&quot;ADODB.Recordset&quot;)
    .Fields.Append &quot;User&quot;,200,150
    .Open
    
    .AddNew : .Fields.Item(&quot;User&quot;) = &quot;123&quot;
    .AddNew : .Fields.Item(&quot;User&quot;) = &quot;456&quot;
    
    .Filter = &quot;User=&#039;123&#039;&quot;
    WScript.Echo .RecordCount
    
    .Filter = &quot;User=&#039;456&#039;&quot;
    WScript.Echo .RecordCount
    
    .Filter = &quot;User=&#039;789&#039;&quot;
    WScript.Echo .RecordCount
    
    .Filter = adFilterNone
    WScript.Echo .RecordCount
End With

WScript.Quit 0
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-04-07T09:45:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81547#p81547</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS поиск в Recordset]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81542#p81542" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>alexii пишет:</cite><blockquote><p>А Вы расскажите глобальную цель. Я уж не припомню сколько .Seek не пользовал.</p></blockquote></div><p>Цель простая. Есть набор записей. Нужно проверить, есть ли конкретная фамилия в этом наборе. Если есть - одно. Если нет - другое. Тупо перебором - долго imho.</p>]]></content>
			<author>
				<name><![CDATA[inock]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25049</uri>
			</author>
			<updated>2014-04-07T09:22:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81542#p81542</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS поиск в Recordset]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81540#p81540" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>На сколько я понимаю, seek не заработает sad</p></blockquote></div><p>Правильно понимаете — <a href="http://support.microsoft.com/kb/287638/en-us">How to use the Seek method with ActiveX Data Objects (ADO) against a Jet recordset</a>:<br /></p><div class="quotebox"><blockquote><p>Additionally, you can use the Seek method only when a recordset is accessing the table directly. In this example, the recordset is instructed to access the table directly by the adCmdTableDirect argument in the Open method. You cannot use the Seek method on objects such as queries and linked tables. You can use the Seek method only on native Microsoft Jet tables. If your database contains linked tables, you can open an external connection to the back-end database that stores the table, and then use the Seek method directly on the table.</p></blockquote></div><div class="quotebox"><blockquote><p>Какие есть альтернативы?</p></blockquote></div><p>А Вы расскажите глобальную цель. Я уж не припомню сколько .Seek не пользовал.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-04-07T09:15:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81540#p81540</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VBS поиск в Recordset]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=81536#p81536" />
			<content type="html"><![CDATA[<p>На сколько я понимаю, seek не заработает <img src="//forum.script-coding.com/img/smilies/sad.png" width="15" height="15" /><br />Какие есть альтернативы?</p><div class="codebox"><pre><code>C:\temp&gt;type ab.vbs
Set UsersIT = CreateObject(&quot;ADODB.Recordset&quot;)
    UsersIT.Fields.Append &quot;User&quot;,200,150
    UsersIT.Open

    UsersIT.AddNew
    UsersIT(&quot;User&quot;) = &quot;123&quot;
    UsersIT.Update

    UsersIT.AddNew
    UsersIT(&quot;User&quot;) = &quot;456&quot;
    UsersIT.Update

x = &quot;123&quot;
UsersIT.Seek &quot;=&quot;, x
 If UsersIT.NoMatch Then
    MsgBox &quot;No&quot;
 Else
    MsgBox &quot;Yes&quot;
 End If

C:\temp&gt;cscript ab.vbs
Сервер сценариев Windows (Microsoft R) версия 5.8
c Корпорация Майкрософт (Microsoft Corp.), 1996-2001. Все права защищены.

C:\temp\ab.vbs(14, 1) ADODB.Recordset: Текущий поставщик не поддерживает необходимый интерфейс для функции Index.
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[inock]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=25049</uri>
			</author>
			<updated>2014-04-07T07:46:02Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=81536#p81536</id>
		</entry>
</feed>
