powered by simpleCommunicator - 2.0.56     © 2025 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / FoxPro, Visual FoxPro [игнор отключен] [закрыт для гостей] / Курсорсхема в курсорадаптере
2 сообщений из 2, страница 1 из 1
Курсорсхема в курсорадаптере
    #35498827
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
close databases all

local lcConnString, lnConnection, ;
	loMyCAD as CursorAdapter, ;
	laErrors[ 1 ]

text to lcConnString noshow pretext  15 
	Driver=SQL Native Client;
	SERVER=свой;
	DATABASE=своя;
	uid=sa;
	pwd=as;
endtext	

lnConnection = sqlstringconnect(lcConnString)
if lnConnection<= 0 
   messagebox('не подцепился')
   return 
endif

text to lcSqlCmd noshow pretext  7 
	if object_id('tempdb..#t') is not null drop table #t
	create table #t ( id int, bigDate datetime )
endtext
if sqlexec(lnConnection, lcSqlCmd)< 0 
	messagebox('не создал табличку')
    return 
endif 

loMyCAD = createobject('CursorAdapter')
with loMyCAD
	.Alias              = 'MyAlias'
	.DataSourceType     = 'ODBC'
	.DataSource         = lnConnection
	.SelectCmd          = "select * from #t"
	.Tables             = 't'
	.BufferModeOverride =  5 
	.cursorschema       = "id i, bigDate d(8)"
	if .CursorFill(!empty(.cursorschema))
		browse
	else
		aerror(laErrors)
		messagebox(laErrors[ 2 ])
	endif .CursorFill(.t.)
endwith

поменяем .cursorschema на "bigDate d(8)" - получаем ошибку

всегда перечисляем все поля в курсорсхеме? или что-то подкрутить?

спасибо
...
Рейтинг: 0 / 0
Курсорсхема в курсорадаптере
    #35499226
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
lparameters tcCADcursorSchema
if !empty(tcCADcursorSchema) and atc("#AllSqlDataToFox#", tcCADcursorSchema)> 0 
	tcCADcursorSchema = upper(strtran(tcCADcursorSchema, "#AllSqlDataToFox#", "", 1 , 1 , 1 ))
	with this
		if empty(.aSqlTableFields[ 1 ]) ;
		   and sqlcolumns(.nConnection, .Tables , "FOXPRO", "sqlTableFields")= 1  ;
		   and used("sqlTableFields")
			select * ;
				from sqlTableFields ;
				into array .aSqlTableFields
		endif
		use in select("sqlTableFields")
		local laAllFields[ 1 ], lnArrayRow, lcFieldName, lcFieldName, lcFieldType
		* узнаем все поля, которые будут в выборке
		if .CursorFill(.f.,.f.) and	afields( laAllFields, .Alias)> 0 
			for lnArrayRow= 1  to alen( .aSqlTableFields,  1 )
				lcFieldName = upper(alltrim(.aSqlTableFields[lnArrayRow, 1 ]))
				lcFieldType = alltrim(.aSqlTableFields[lnArrayRow, 2 ])
				if ascan(laAllFields, lcFieldName)> 0  and empty(at(lcFieldName+" ", tcCADcursorSchema))
					tcCADcursorSchema = tcCADcursorSchema + iif(!empty(tcCADcursorSchema), ", ", "") + ;
										lcFieldName + ;
										iif( inlist( lcFieldType, "D", "T") and lcFieldName<>"TIMESTAMP", ;
											 " d(8)", ;
											 " " + lcFieldType + " (" + transform(.aSqlTableFields[lnArrayRow, 3 ]) + ;
											 					        "," + ;
											 					        transform(.aSqlTableFields[lnArrayRow, 4 ]) + ")" ;
											)
				endif
			endfor
		else
			tcCADcursorSchema = .f.
		endif 
	endwith
endif 
return .t.


пример решения по принципу - "потруси-покрутим", что не оч.нравится
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / FoxPro, Visual FoxPro [игнор отключен] [закрыт для гостей] / Курсорсхема в курсорадаптере
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]