Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Retrieve the primary key column when opening MS SQL tables and no ide…
…ntity column has been specified
  • Loading branch information
szekerest authored and NathanW2 committed Mar 28, 2012
1 parent 8f22e21 commit 067d7dd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -337,6 +337,19 @@ void QgsMssqlProvider::loadFields()
}
}
}
// get primary key
if ( mFidColName.isEmpty() )
{
mQuery.clear();
mQuery.exec( QString( "exec sp_pkeys N'%1', NULL, NULL" ).arg( mTableName ) );
if ( mQuery.isActive() )
{
if ( mQuery.next() )
{
mFidColName = mQuery.value( 3 ).toString();
}
}
}
}


Expand Down

0 comments on commit 067d7dd

Please sign in to comment.