c# - Ozeki is not returning other records -
i'm doing ozeki messenger project using c#. want retrieve more 1 record table. returning me first record only...
here's code. idea doing wrong guys?
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 tblpharmacy 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) { } }
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 tblpharmacy 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) { } }
i got answer myself.. lol. response.redirect should outside while loop. works fine :d
Comments
Post a Comment