title: database schema has changed
body: <p>I keep getting this error <code>database schema has changed near "1": syntax error</code>.</p>
  
  <p>I am not changing my schema in the code.
  This is the code where I make the schema.
  wish to try each answer in order that you posted it.
  This code is used to transfer a database to another database program.
  So it has to be compatible with more then one database program.</p>
  
  <pre><code>public DataTable GetSchemaTable(string schema, string nameTable)
      {
          switch (m_dbType)
          {
              case dbTypeEnum.Sqlite:
                  //Make the schema of the source table
                  MakeConnectionString();
                  string fullTableName = schema.Length &gt; 0
                      ? string.Format("[{0}].[{1}]", schema, nameTable)
                      : string.Format("[{0}]", nameTable);
                  if (!string.IsNullOrEmpty(fullTableName))
                  {
                      string sql = string.Format("SELECT * FROM {0} LIMIT 1", fullTableName);
                      DataTable dtSchemaSource;
                      try
                      {
                          using (IDataReader rdr = ReadOnlyForwardOnly(sql))
                          {
                              dtSchemaSource = rdr.GetSchemaTable();
                          }
                      }
                      finally
                      {
                          CloseConnection();
                      }
                      if (dtSchemaSource == null)
                      {
                          throw new RadGeneralException("rdr.GetSchemaTable() returns null with sql = " + sql);
                      }
  
                      return dtSchemaSource;
                  }
                  break;
  
              default:
                  //Make the schema of the source table
                  MakeConnectionString();
                  string fullTableName = schema.Length &gt; 0
                      ? string.Format("[{0}].[{1}]", schema, nameTable)
                      : string.Format("[{0}]", nameTable);
                  string sql = string.Format("SELECT TOP 1 * FROM {0}", fullTableName);
                  DataTable dtSchemaSource;
                  try
                  {
                      using (IDataReader rdr = ReadOnlyForwardOnly(sql))
                      {
                          dtSchemaSource = rdr.GetSchemaTable();
                      }
                  }
                  finally
                  {
                      CloseConnection();
                  }
                  if (dtSchemaSource == null)
                  {
                      throw new RadGeneralException("rdr.GetSchemaTable() returns null with sql = " + sql);
                  }
                  return dtSchemaSource;
  
          }
      }
  </code></pre>
  
  <p>This is the part where the sqlite schema has changed arror occurs.</p>
  
  <pre><code>StringBuilder sbColList = new StringBuilder();
          nCol = 0;
          identityColInBothTables = false;
          //Make the schema of the source table
          DataTable dtSchemaSource = objDbSource.GetSchemaTable(SchemaSource, Name);
          //Make the schema of the target table
          DataTable dtSchemaTarget = objDbTarget.GetSchemaTable(SchemaTarget, Name);
  </code></pre>