Answer the question
In order to leave comments, you need to log in
How to write data via com connection to DB 1s using python?
I managed to get data from the database in python, but how to implement an entry in the 1s directory?
from django.shortcuts import render
import pythoncom
import win32com.client
def index(request):
V83_CONN_STRING = 'File="C:\\Users\\admin2\\Documents\\InfoBase18";Usr="Ермолин";Pwd="123";'
pythoncom.CoInitialize()
V83 = win32com.client.Dispatch("V83.COMConnector").Connect(V83_CONN_STRING)
q = '''
ВЫБРАТЬ
ТестСправочник.Фамилия КАК Фамилия,
ТестСправочник.Имя КАК Имя,
ТестСправочник.Отчество КАК Отчество
ИЗ
Справочник.ТестСправочник КАК ТестСправочник
'''
query = V83.NewObject("Query", q)
sel = query.Execute().Choose()
num_category = []
while sel.next():
num_category.append(sel.Фамилия)
num_category.append(sel.Имя)
num_category.append(sel.Отчество)
#break
return render(request, 'index.html', context={'num_category':num_category},)
Answer the question
In order to leave comments, you need to log in
Try like this:
новЭлемент = V83.Справочники[ИмяСправочника].СоздатьЭлемент();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question