Skip to content
Permalink
Browse files

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 067d7dd467488b7781e8d209d2666d503e7d020d
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/providers/mssql/qgsmssqlprovider.cpp
@@ -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();
}
}
}
}


0 comments on commit 067d7dd

Please sign in to comment.
You can’t perform that action at this time.