Friday, November 22, 2013

C# Code Behind not accessing controls in ASP .NET

  I had an issue where I would add controls to my aspx file but the control was not visible, hence not usable, from the code behind page. I noticed there was not a .aspx.designer.cs file. I right clicked on the aspx file and chose the "Convert To Web Application". This generated the .aspx.designer.cs file and gave me access to the controls on the aspx page from the code behind code.
   So look to see if you have a .aspx.designer.cs file and regenerated it if needed.





Monday, November 18, 2013

MYSQL AutoIncrement reset after restart

     I found out that the autoincrement values can change on a restart of the service.  This affected the claims checkprinting table, because it is cleared after the AP process runs, so on restart, there are no records and the autoincrement is set to 1.
   I found an option, init-file in the my.ini file, that can be set to execute a start up file when the MYSQL service starts. So I created a SQL file that updates the autoincrement value from the checkprintinghistory file.

use claim;
select max(processkey) into @maxProcessKey from checkprintinghistory;
insert into checkprinting (uniquekey,iservicer,isprocessed,isapplied) values(@maxProcesskey,2,1,1);
delete from checkprinting where uniquekey = @maxProcesskey;

  Now on restart, this init program finds the highest value and resets the autoincrement value on checkprinting to the correct value.