Article View: cn.bbs.comp.lang.visual-basic
Article #21032Re: �洢�����α�д�����ܹ����ݲ����ȥ
From: ��������
Date: Tue, 22 Jul 2003 07:51
Date: Tue, 22 Jul 2003 07:51
67 lines
3166 bytes
3166 bytes
�÷���ʹ�� Append �� CreateParameter ����ִ�о����������Ĵ洢��̡�
Public Sub AppendX()
Dim cnn1 As ADODB.Connection
Dim cmdByRoyalty As ADODB.Command
Dim prmByRoyalty As ADODB.Parameter
Dim rstByRoyalty As ADODB.Recordset
Dim rstAuthors As ADODB.Recordset
Dim intRoyalty As Integer
Dim strAuthorID As String
Dim strCnn As String
' �����ӡ�
Set cnn1 = New ADODB.Connection
strCnn = "Provider=sqloledb;" & _
"Data Source=srv;Initial Catalog=pubs;User Id=sa;Password=; "
cnn1.Open strCnn
cnn1.CursorLocation = adUseClient
' ʹ�õ�һ������������
Set cmdByRoyalty = New ADODB.Command
cmdByRoyalty.CommandText = "byroyalty"
cmdByRoyalty.CommandType = adCmdStoredProc
' ��ȡ����ֵ���Ӳ���
intRoyalty = Trim(InputBox("Enter royalty:"))
Set prmByRoyalty = cmdByRoyalty.CreateParameter("percentage", _
adInteger, adParamInput)
cmdByRoyalty.Parameters.Append prmByRoyalty
prmByRoyalty.Value = intRoyalty
' ͨ��ִ���������¼����
Set cmdByRoyalty.ActiveConnection = cnn1
Set rstByRoyalty = cmdByRoyalty.Execute
' �� Authors ���Ի�ȡ�������������ʾ��
Set rstAuthors = New ADODB.Recordset
rstAuthors.Open "authors", cnn1, , , adCmdTable
' ��ӡ��¼���еĵ�ǰ��ݣ��� Authors ���������������
Debug.Print "Authors with " & intRoyalty & " percent royalty"
Do While Not rstByRoyalty.EOF
strAuthorID = rstByRoyalty!au_id
Debug.Print " " & rstByRoyalty!au_id & ", ";
rstAuthors.Filter = "au_id = '" & strAuthorID & "'"
Debug.Print rstAuthors!au_fname & " " & rstAuthors!au_lname
rstByRoyalty.MoveNext
Loop
rstByRoyalty.Close
rstAuthors.Close
cnn1.Close
End Sub
MSDN ���ĵ���
�� �� liyihongcug (lili) �Ĵ������ᵽ: ��
: �洢�����α�д�����ܹ����ݲ����ȥ
--
[m[1;34m�� ��Դ:��BBS ˮľ�廪վ smth.org��[FROM: 211.91.90.58][m
Technical Details
Message-ID:
<000000$3DJ@smth.org>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!maily.cic.tsinghua.edu.cn!SMTHShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,GB X-Google-Thread: 10a1a8,bf5c4265854ba4eb X-Google-Attributes: gid10a1a8,public X-Google-Thread: 109fdd,d53beff0ab2992cf X-Google-Attributes: gid109fdd,public X-Google-ArrivalTime: 2003-07-22 01:20:03 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!maily.cic.tsinghua.edu.cn!SMTH From: CityhunterId@smth.org (��������) Newsgroups: cn.bbs.comp.lang.visual-basic Subject: Re: �洢�����α�д�����ܹ����ݲ����ȥ Date: 22 Jul 2003 07:51:48 GMT Organization: BBS ˮľ�廪վ Message-ID: <000000$3DJ@smth.org> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: VisualBasic/u/M.1058860204.00 Lines: 67