c# - Getting Messages back from postgres -


i initiating vacuum process in postgres c# executable. want message returned executable, i'm not able message output window.

in short, i'm looking equivalent of in postgres using npgsql like:

// display messages code sql server reteive data message tab  conn.infomessage += delegate(object sender, sqlinfomessageeventargs e) {   stdmform.txtlastsqlmessages.text +`=` "\n" + e.message; }; 

i want message in c# code using npgsql.

i tried code below. give complete execution log. parsed required log. it's not best way not able find else.

//log vacuum command information npgsqleventlog.level = loglevel.debug; npgsqleventlog.logname = vacuumlogfilepath + "rolling.log";  npgsqleventlog.echomessages = false;  try {     //run vacuum command     npgsqlcommand comm = new npgsqlcommand("vacuum verbose analyze", connection);      comm.executenonquery();  } 

Comments