我正在使用 C# 做一个 Ozeki Messenger 项目。我想从表中检索多条记录。它只给了我第一张唱片……
这是我的代码。任何想法做错了什么?
protected void Page_Load(object sender, EventArgs e)
{
try
{
String x;
String y;
String z;
String SenderNumber, receiverNumber, message;
SenderNumber = Request.QueryString.Get("sender");
receiverNumber = Request.QueryString.Get("receiver");
message = Request.QueryString.Get("msg");
SqlConnection connection = new SqlConnection();
SqlCommand command = new SqlCommand();
SqlDataReader reader;
connection.ConnectionString = Constring;
command.Connection = connection;
command.CommandText = "SELECT P_Name, P_Parking FROM tblPharmacy Where Code = '" + message + "'" ;
connection.Open();
reader = command.ExecuteReader();
String data = "";
while (reader.Read())
{
x = reader["P_Name"].ToString();
y = reader["P_Parking"].ToString();
data += x + " " + y + " - ";
Response.Redirect("http://localhost:9333/ozeki?login=admin&password=xxxxxx&action=sendMessage&messagetype=SMS:TEXT&recepient=" + SenderNumber + " &messageData= " + data);
}
reader.Close();
connection.Close();
}
catch (Exception)
{
}
}