标题:新手菜鸟,求助!急!急!
只看楼主
安一心
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-12-15
 问题点数:0 回复次数:2 
新手菜鸟,求助!急!急!
求一个查询代码。
就是想让查询结果显示在一个文本框里 代码怎么写?
搜索更多相关主题的帖子: 查询 文本框 
2012-12-15 20:17
角角鱼
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-12-4
得分:0 
回复 楼主 安一心
Try
                conn.Open()
                Dim cmd_sel5 As New OleDbCommand(sel_str5, conn)
                Dim ds5 As New OleDbDataAdapter(cmd_sel5)
                Dim da5 As New DataSet()
                ds5.Fill(da5)
                TextBox_ownteam_shili.Text = da5.Tables(0).Rows(0)(0).ToString()
                conn.Close()
                cmd_sel5.Dispose()
                cmd_sel5 = Nothing
                ds5.Dispose()
                ds5 = Nothing
                da5.Dispose()
                da5 = Nothing
            Catch ex As Exception
                MessageBox.Show(ex.Message.ToString())
            End Try
2013-01-14 09:30
角角鱼
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2012-12-4
得分:0 
回复 楼主 安一心
Dim sel_str5 As String
            sel_str5 = "select shili from football_shili where county ='" & ComboBox_county.Text & "' and season = '" & TextBox_saiji.Text & "' and teamname='" & TextBox_ownteam.Text & "'"
            Try
                conn.Open()
                Dim cmd_sel5 As New OleDbCommand(sel_str5, conn)
                Dim ds5 As New OleDbDataAdapter(cmd_sel5)
                Dim da5 As New DataSet()
                ds5.Fill(da5)
                TextBox_ownteam_shili.Text = da5.Tables(0).Rows(0)(0).ToString()
                conn.Close()
                cmd_sel5.Dispose()
                cmd_sel5 = Nothing
                ds5.Dispose()
                ds5 = Nothing
                da5.Dispose()
                da5 = Nothing
            Catch ex As Exception
                MessageBox.Show(ex.Message.ToString())
            End Try
        End If
2013-01-14 09:32



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-391421-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.377783 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved