You are missing a fair bit of code after
string emailBody = mail.EmailBody;
as in the extraction of those values from the email body!
One approach that is possibly the simplest to follow is
1. Split the email body into the individual lines - lots of examples
here[
^]
2. For each of the lines of email body look for the key words/phrases that you are interested in - you could use
String.IndexOf Method [
^] for that
3. Grab the actual value for each key word/phrase - you could use the
String.Substring Method [
^] for that, or you could split each line using the ":" character
4. You can then set up your parameters for your SQL statement as you already have - I'm hoping that your variable
paramName
is properly constructed, I don't really see the point of using variables for
tableName
,
colName
or
paramName
here as you know what parameters will be needed.
5. As @Richard-Deeming has pointed out - use ExecuteNonQuery to run the insert and get rid of the pointless
MySqlDataReader read = null;
You are probably going to hit issues with the values returned - the most common error with beginners is not allowing for the position of the actual ":" character when using IndexOf for example. Use the debugger to help yourself understand how to change the code - see the CP article
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[
^]
Give it a go and write the code, then if you are still stuck come back with that code and we will try to help you further. But we won't write it for you