日期:2014-05-18  浏览次数:20401 次

帮忙看看这个,很基础
“+++”显示了,“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);是读取数据