Public voidasyncwritedatabase () {varSpname =""; while(true) { Try { varJsontext = Redishelper.blockingpopitemfromlist ("async_write_list"); varo =(Jobject) jsonconvert.deserializeobject (Jsontext); if(o["Need_newcache"]. ToString ()! ="0")Continue; Spname=o["Action"]. ToString (); varJobject = o["Paras"]; varparas =NewMysqlparameter[jobject.children (). Count ()]; varCount =0; foreach(Jproperty IteminchJobject.children ()) { if(item. Value.tostring (). Length >=1024x768) {Paras[count]=NewMysqlparameter (item. Name, Mysqldbtype.mediumtext); //var bytes = System.Text.Encoding.UTF8.GetBytes (item. Value.tostring ()); //Paras[count]. Value = bytes; //If the following code does not work, try the commented out code aboveParas[count]. Value =item. Value.tostring (); } Else{Paras[count]=NewMysqlparameter (item. Name, Mysqldbtype.varchar,1024x768); Paras[count]. Value=item. Value; } Count++; } sqlhelper.executenonquery (Sqlhelper.connectionstring, CommandType.StoredProcedure, SpName, paras); Program.myFrm.SetTextMessage ("the stored procedure that was successfully written to the asynchronous database record, called:"+ Spname,3); } Catch(Exception err) {Program.myFrm.SetTextMessage ("failed to write to asynchronous database record, called stored procedure:"+ spname+", the cause of the error:"+err,3); } } }
MySQL large text parameters for serial write queue