当前位置: 代码迷 >> ASP.NET >> 帮忙看看这个,很基础解决办法
  详细解决方案

帮忙看看这个,很基础解决办法

热度:5640   发布时间:2013-02-25 00:00:00.0
帮忙看看这个,很基础
“+++”显示了,“222”也显示了,就是username值没显示,sql是没问题的,有返回值

Sub   Page_Load(obj   As   object,e   As   eventargs)
Dim   queryString   As   String   =   "SELECT   DISTINCT   username   FROM   tb_users   where   userid   =   2882 "

        Using   connection   As   New   OdbcConnection( "DSN=...... ")
                Dim   command   As   New   OdbcCommand(queryString,   connection)
                connection.Open()
                Dim   reader   As   OdbcDataReader   =   command.ExecuteReader()
response.write( "+++ ")
                While   reader.Read()
response.write( "222 ")
Console.WriteLine(   ",   "   &   reader.GetString(0))
                        Console.WriteLine( "CustomerID={0} ",   reader(0).ToString)
                End   While
                '   Call   Close   when   done   reading.
                reader.Close()
        End   Using

End   Sub

------解决方案--------------------------------------------------------
Console.WriteLine在web下没有用的
改成response.write
------解决方案--------------------------------------------------------
怎么变成了reader(0).ToString?这样写是获取列名的
reader.getString(0);是读取数据
  相关解决方案