Table 'opendental.apptfield' doesn't exist" (head)

This forum is for programmers who have questions about the source code.
Post Reply
User avatar
wjstarck
Posts: 936
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Table 'opendental.apptfield' doesn't exist" (head)

Post by wjstarck » Mon Jul 19, 2010 11:51 am

I'm crashing while debugging the latest head:

Code: Select all

MySql.Data.MySqlClient.MySqlException was unhandled
  Message="Table 'opendental.apptfield' doesn't exist"
  Source="MySql.Data"
  Number=1146
  StackTrace:
       at MySql.Data.MySqlClient.PacketReader.CheckForError()
       at MySql.Data.MySqlClient.PacketReader.ReadHeader()
       at MySql.Data.MySqlClient.PacketReader.OpenPacket()
       at MySql.Data.MySqlClient.NativeDriver.ReadResult(Int64& affectedRows, Int64& lastInsertId)
       at MySql.Data.MySqlClient.CommandResult.ReadNextResult(Boolean isFirst)
       at MySql.Data.MySqlClient.CommandResult..ctor(Driver d, Boolean isBinary)
       at MySql.Data.MySqlClient.NativeDriver.SendQuery(Byte[] bytes, Int32 length, Boolean consume)
       at MySql.Data.MySqlClient.MySqlCommand.GetNextResultSet(MySqlDataReader reader)
       at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
       at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
       at MySql.Data.MySqlClient.MySqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
       at OpenDentBusiness.DataConnection.GetTable(String command) in C:\Users\wjs\Desktop\ODVersions\opendental7.2b\opendental7.2\OpenDentBusiness\DataConnection.cs:line 235
       at OpenDentBusiness.Appointments.GetApptFields(DataTable tableAppts) in C:\Users\wjs\Desktop\ODVersions\opendental7.2b\opendental7.2\OpenDentBusiness\Data Interface\Appointments.cs:line 968
       at OpenDentBusiness.Appointments.RefreshPeriod(DateTime dateStart, DateTime dateEnd) in C:\Users\wjs\Desktop\ODVersions\opendental7.2b\opendental7.2\OpenDentBusiness\Data Interface\Appointments.cs:line 515
       at OpenDental.ContrAppt.RefreshModuleDataPeriod() in C:\Users\wjs\Desktop\ODVersions\opendental7.2b\opendental7.2\OpenDental\Main Modules\ContrAppt.cs:line 1180
       at OpenDental.ContrAppt.RefreshPeriod() in C:\Users\wjs\Desktop\ODVersions\opendental7.2b\opendental7.2\OpenDental\Main Modules\ContrAppt.cs:line 1143
       at OpenDental.ContrAppt.InitializeOnStartup() in C:\Users\wjs\Desktop\ODVersions\opendental7.2b\opendental7.2\OpenDental\Main Modules\ContrAppt.cs:line 1591
       at OpenDental.FormOpenDental.SetModuleSelected() in C:\Users\wjs\Desktop\ODVersions\opendental7.2b\opendental7.2\OpenDental\Main Modules\FormOpenDental.cs:line 2808
       at OpenDental.FormOpenDental.FormOpenDental_Load(Object sender, EventArgs e) in C:\Users\wjs\Desktop\ODVersions\opendental7.2b\opendental7.2\OpenDental\Main Modules\FormOpenDental.cs:line 1421
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, Int32 wParam, Int32 lParam)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at OpenDental.ProgramEntry.Main(String[] args) in C:\Users\wjs\Desktop\ODVersions\opendental7.2b\opendental7.2\OpenDental\Main Modules\ProgramEntry.cs:line 44
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
Thanks
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

User avatar
jordansparks
Site Admin
Posts: 5742
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: Table 'opendental.apptfield' doesn't exist" (head)

Post by jordansparks » Mon Jul 19, 2010 12:03 pm

Don't forget to keep an eye on OpenDentBusiness\Misc\ConvertDatabase2.cs. As we add queries, you must run them. Or, if there are too many, start with a new database from the beta version.
Jordan Sparks, DMD
http://www.opendental.com

User avatar
wjstarck
Posts: 936
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Re: Table 'opendental.apptfield' doesn't exist" (head)

Post by wjstarck » Mon Jul 19, 2010 12:43 pm

jordansparks wrote: As we add queries, you must run them.
I'm not sure what you mean...
jordansparks wrote:if there are too many, start with a new database from the beta version.
Hmm, tried that, doesn't seem to help...
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

User avatar
jordansparks
Site Admin
Posts: 5742
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: Table 'opendental.apptfield' doesn't exist" (head)

Post by jordansparks » Mon Jul 19, 2010 6:58 pm

Did you look at that file? At the end of it you will see a series of queries which will get run when you upgrade to 7.2.0. But if you are already at 7.2.0 (which you will be if you have been working on the head), then no upgrade process will be triggered. So, you either have to run those queries manually as we add them, or you have to start with a 7.1 database. I would be very surprised if a new database didn't work. Although there could be an error in one of those queries I suppose. Did it tell you that the version upgrade was successful?
Jordan Sparks, DMD
http://www.opendental.com

User avatar
wjstarck
Posts: 936
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX
Contact:

Re: Table 'opendental.apptfield' doesn't exist" (head)

Post by wjstarck » Tue Jul 20, 2010 7:51 am

Looks like there may be several Db.NonQ(command)s missing at the bottom of ConvertDatabase2.cs. This section should look like:

Code: Select all

command="DROP TABLE IF EXISTS apptfield";
Db.NonQ(command);
command=@"CREATE TABLE apptfield (
ApptFieldNum bigint NOT NULL auto_increment,
AptNum bigint NOT NULL,
FieldName varchar(255) NOT NULL,
FieldValue text NOT NULL,
PRIMARY KEY (ApptFieldNum),
INDEX(AptNum)
) DEFAULT CHARSET=utf8";
Db.NonQ(command);
command="DROP TABLE IF EXISTS apptfielddef";
Db.NonQ(command);
ApptFieldDefNum bigint NOT NULL auto_increment,
FieldName varchar(255) NOT NULL,
PRIMARY KEY (ApptFieldDefNum)
) DEFAULT CHARSET=utf8";
Db.NonQ(command);
After I make those changes everything works as expected...
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA

User avatar
jordansparks
Site Admin
Posts: 5742
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: Table 'opendental.apptfield' doesn't exist" (head)

Post by jordansparks » Tue Jul 20, 2010 12:18 pm

Sorry about that. It was generated by a script. Looks like the script needs a little work.
Jordan Sparks, DMD
http://www.opendental.com

Post Reply