I have a Windows application and need to send some data to a remote server. I send the data but it sends only one value, so I need to read a table from SQL Server and send all values in that table at once.
The code to send data:
private void SaveUser()
{
CN.conn = CN.connection;
CN.cmd = new SqlCommand("SELECT [FULLNAME] FROM STUDENTS", CN.conn);
CN.conn.Close();
CN.conn.Open();
CN.dr = CN.cmd.ExecuteReader();
while (CN.dr.Read())
{
try
{
using (var wb = new WebClient())
{
var data = new NameValueCollection();
data["latitude"] = CN.dr[0].ToString();
var response = wb.UploadValues("https://urbanwaste.000webhostapp.com/user/pickup.php", "POST", data);
string responseInString = Encoding.UTF8.GetString(response);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
MessageBox.Show("Successfully");
}
CN.conn.Close();
}
My database table:
Thank you

