mardi 1 septembre 2015

database schema has changed

I keep getting this error database schema has changed near "1": syntax error.

I am not changing my schema in the code. This is the code where I make the schema.

public DataTable GetSchemaTable(string schema, string nameTable)
{
    //Make the schema of the source table
    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;
}

Aucun commentaire:

Enregistrer un commentaire