这是我正在使用的内容:
Dim connstr = "data source=mydatasource;initial catalog=gcs_dw;persist security info=True;user id=myuser;password=mypassword;Asynchronous Processing=True"
Dim sqlquery = "SELECT * FROM Customer WHERE CITY = 'Anytown'"
Dim connection As SqlConnection = New SqlConnection(connstr)
connection.Open()
Dim command As SqlCommand = connection.CreateCommand()
command.CommandText = sqlquery
Dim reader As SqlDataReader = command.ExecuteReader()
reader.Read()
Console.WriteLine(reader.ToString)
connection.Close()
Console.Read()
如您所见,我正在尝试将查询结果显示到命令行,目前它显示的只是“System.Data.SqlClient.SqlDataReader”。我的 sql 查询的结果在哪里,为什么我不能检索它们?