I keep getting this error database schema has changed near "1": syntax error.
I do not change my scheme in the code. This is the code in which I am making the circuit. want to try every answer to post it. This code is used to transfer the database to another database program. Therefore, it must be compatible with more than one database program.
public DataTable GetSchemaTable(string schema, string nameTable)
{
switch (m_dbType)
{
case dbTypeEnum.Sqlite:
MakeConnectionString();
string fullTableName = schema.Length > 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:
MakeConnectionString();
string fullTableName = schema.Length > 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;
}
}
This is the part where the sqlite schema has changed.
StringBuilder sbColList = new StringBuilder();
nCol = 0;
identityColInBothTables = false;
DataTable dtSchemaSource = objDbSource.GetSchemaTable(SchemaSource, Name);
DataTable dtSchemaTarget = objDbTarget.GetSchemaTable(SchemaTarget, Name);
source
share