🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.lang.visual-basic
1 messages
1 total messages Started by panfock Thu, 12 Apr 2007 03:18
Re: ��̹���VB�ж�ȡ��ݿ���ݵ�����
#46
Author: panfock
Date: Thu, 12 Apr 2007 03:18
38 lines
2538 bytes
�� �� dqkit �Ĵ������ᵽ: ��
: ��λ��������֪����VB��ΰ���ݿ�����һ���������ijһ�е����ͳ�Ƴ���������Select count(*)=num from....��ȡ����ֻ����DataGrid��ʾ��������֪����ΰ�num��ֵ�ŵ�һ��textBox�����أ�лл��
: ������datagridʱ��Դ�룺
: Private Sub Command1_Click()
:      Data1.RecordSource = "SELECT count(*),sum(*) FROM answered WHERE 
:      person=" & "'" & Text1.Text & "'"
:      Data1.Refresh
: End Sub
: ��������һ���ı���������Ҫ�������ġ�

re:��֪������ı��������⣬�����ҵ�������������⣬���Ǻ���������˼��
���Dz�������
Private Sub Command1_Click()
     Dim strsql As String
     Dim con As New ADODB.Connection '������ݿ���
     Dim rs As ADODB.Recordset    '������ݼ�
         '������ݿ�,���������ݿ��ļ����ļ����ֱ��������ȻҪд����ַ�
         '������Ϊ�˷�������ODBC DSN���Դ
     con.Open "DNS=mydatabase"
     strsql = "select count(userid),sum(mark) from answered where person='" & Trim(text1.Text) & "'"
     Set rs = con.Execute(strsql)  'ִ��SQL��������ݼ�
     If Not rs.EOF Then
        txtCount.Text = rs(0)    '�ѷ���ֵ��ʾ��TEXTBOX��
        txtSum.Text = rs(1)
     End If
     rs.Close
     conn.Close
End Sub


--
pppppp ffffff
nnnnnn oooooo
aaaaaa cccccc
kkkkkkkkkkkkk

�� ��Դ ����ɾ�bbsվ http://bbs.scau.edu.cn [FROM: 58.62.223.*]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads