假设以下代码返回整个结果行:using (SqlCommand cmdMessages = new SqlCommand("SELECT * FROM Email where Sender = @usernameLog", conn)){ cmdMessages.Parameters.Add(new SqlParameter("@usernameLog", Sender)); using (SqlDataReader reader = cmdMessages.ExecuteReader()) { while (reader.Read()) { Console.Write(); // Receiver's Name which comes from database Console.Write();// The message which comes from same row as the receiver's name } }}该查询在SQL Server中工作正常。SQL Server的输出: User hi 我想在控制台中有相同的输出。
2 回答
- 2 回答
- 0 关注
- 122 浏览
添加回答
举报
0/150
提交
取消