Communication Error

Just in case "poonamb" reads this… I’d love to reply to your question, but Live won’t let me.  I tried but got the error "You can’t send or reply to this person because of their communication settings."

To answer your question, however.  I would guess that the problem with saving your ruleset to the database is right around this area here:

RuleSetDialog ruleDialog = new RuleSetDialog(typeof(Patient), null, ruleSet);
DialogResult result = ruleDialog.ShowDialog();
if (result == DialogResult.OK)
{
    SerializeRuleSet(ruleSet);
}

You’re making a call to SerializeRuleSet, but not doing anything with the answer.  You need to take the result of SerializeRuleSet, which will be a string, and save it off to the database in the same table you load it from elsewhere in your code.

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Communication Error

  1. Mel says:

    Again, I can\’t respond to Poonamb because of his preferences.  I\’ll try to anser here as best I can.  I haven\’t hand-rolled data access code in a number of years (NHibernate / Linq FTW!), but I\’s immediately have a couple questions for you.  I see that the call to SerializeRuleSet(ruleSet) is the last line of the code you sent me.  Seems like it ought to be a bit closer to the top if you intend to save its results to the database.  You need to capture the result of the SerializeRuleSet call, and save THAT to the database… not just ruleSet.ToString.  That\’s just going to get you the full name of the RuleSet class, I would think.
     
    Also, you\’re attempting to read from a non-query AFTER closing the connection, either one of which would fail on its own, but they will most certainly not accomplish anything together.
     
    Try this:if (result == DialogResult.OK) {    string serial = SerializeRuleSet(ruleSet);    string cmdString = "update RuleSet set RuleSet=\’" + serial + "\’ where Name= \’" + ruleSetName + "\’ ";     SqlConnection conn = new SqlConnection(connectionString);    conn.Open();    SqlCommand cmd = new SqlCommand(cmdString, conn);    int read = cmd.ExecuteNonQuery();    conn.Close();}
     
    …or something like that.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s