I am getting errors on variables FaxPro, EmailPro, FaxStat, and EmailStat.
while (reader.Read())
{
string CustNo = reader["CUSTNO"].ToString();
string Phone = reader["PHONE"].ToString();
string Fax = reader["FAX"].ToString();
string Email = reader["PRI_EMAIL"].ToString();
string Type = reader["TYPE"].ToString();
if (Type.Contains("H"))
{
if (Type.Contains("F"))
{
string FaxStat = "Y";
string FaxPro = "PENDING";
}
else
{
string FaxStat = "N";
string FaxPro = "NONE";
}
if (Type.Contains("E"))
{
string EmailStat = "Y";
string EmailPro = "PENDING";
}
else
{
string EmailStat = "N";
string EmailPro = "NONE";
}
//outbox
// id, account, type, title, number, fax, email, faxpro, emailpro, faxstat, emailstat, filepath, datesent
MySqlCommand mycommand = new MySqlCommand("INSERT INTO outbox (id, account, type, title, number, fax, email, faxpro, emailpro, faxstat, emailstat, filepath, datesent) VALUES('0','" + CustNo + "', 'CUSTOMER', 'test', '" + Phone + "', '" + Fax + "', '" + Email + "', '" + FaxPro + "', '" + EmailPro + "', '" + FaxStat + "', '" + EmailStat + "', 'test', NOW())", conn);
mycommand.ExecuteNonQuery();
Errors are:
The name 'FaxPro' does not exist in the current context C:...\Form2.cs
... and so on for EmailPro, FaxStat, and EmailStat.