简体   繁体   中英

Django-MSSQL error when creating a user from the admin panel

I am a bit stuck, my app is nearly finished and I have a problem, I can't create a user with the admin panel.

I am using django 1.9 and MSSQL and when I go to my admin panel (with a superuser I created in the shell), I have my groups and my users, I can enter them both, but when I want to add a user it gives me this error :

(-2147352567, 'Une exception s\\x92est produite.', (0, u'Microsoft OLE DB Provider for SQL Server', u"Impossible d'ex\\xe9cuter SAVE TRANSACTION quand aucune transaction n'est active.", None, 0, -2147467259), None) Command: SAVE TRANSACTION [s6736_x1] Parameters: []

The translation is :

(-2147352567, 'An exception has happend.', (0, u'Microsoft OLE DB Provider for SQL Server', u"Impossible to execute SAVE TRANSACTION when no transaction is active.", None, 0, -2147467259), None) Command: SAVE TRANSACTION [s6736_x1] Parameters: []

When I try to add a group I have no problem, I can access the group creation form.

If anyone has an idea I would be thanksful.

Here is my traceback :

Environment:


Request Method: GET
Request URL: http://localhost:8000/admin/auth/user/add/

Django Version: 1.9.6
Python Version: 2.7.11
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'reception']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Found my error, I just modify my SQL provider from : "SQLOLEDB" to "SQLNCLI11"

There is an error on the django-mssql website in the "read the docs", it is written that the default provider is SQLCLI10, which is true and it but this provider does not exist, it is SQL N CLI10.

And now it works perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM