値のキャスト エラーが発生していUrl
ます。複数の値の型を含む文字列に値をキャストする方法を知っている人はいますか?
CmdRecipients = new OleDbCommand(QueryRecipients, ConnRecipients);
Recipients = CmdRecipients.ExecuteReader();
while (Recipients.Read())
{
Url = "https://bulktext.vodafone.ie/sendmessage.aspx"
+ "?user=user&password=user1!&api_id=89&to="
+ Recipients.GetString(8)
+ "&text=" + Confirmations.GetString(4)
+ "%0d%0a" + Confirmations.GetString(5)
+ "%0d%0a" + Confirmations.GetString(6)
+ "&from=Service";
Console.Write("Sending text to " + Recipients.GetString(8) + " ... ");
//Send SMS Here
HttpWebRequest req = WebRequest.Create(Url) as HttpWebRequest;
string result = null;
using (HttpWebResponse resp = req.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(resp.GetResponseStream());
result = reader.ReadToEnd();
if (result == "0\nRequest deferred successfully")
{
QueryRecipients = "UPDATE [Test].[dbo].[MessagesToSend] SET Previous_Status = Current_Status,"
+ "Current_Status = \"Sent\", DateTime_sent = Now() "
+ "WHERE Task_ID = \"" + Recipients.GetString(2) + "\";";
OleDbCommand Update = new OleDbCommand(QueryRecipients, ConnConfirmations);
Update.ExecuteNonQuery();
Console.WriteLine("Done!");
}
else
{
Console.WriteLine("The text wasn't delivered properly.");
}
}
}