I've discovered the problem.
The problem was a text Field on the table, eliminating it the problem disappear.
Now i have some questions:
Is This a Bug ?
Why the problem tha i have in a table and that i have reproduced below is not present in another table (the master table in the preceding message) that have a text field ?
Any answer is appreciated!
Thanx in Advance.
** __________________
#define MAX_FIELDS 1
private nHandle
SQLSetProp(0, "Displogin", 1)
nHandle = SQLStringConnect('Driver=Sql Server')
Visual FoxPro;WSID=WXP04;DATABASE=ADB_Demo;Trusted_Connection=Yes')
If nHandle <= 0
MessageBox('No Connection')
Return
EndIf
Local i
Local cStmt, cStmtValues
cStmt = ''
For i = 1 To MAX_FIELDS
cStmt = cStmt + ', Field' + Transform(i) + ' Text Not Null'
EndFor
cStmt = 'Create Table #Temp(' + Substr(cStmt, 3) + ')'
xSQLExec(cStmt)
xSQLExec('Select * From #Temp', 'Temp')
Append Blank
For i = 1 To MAX_FIELDS
Replace ('Field' + Transform(i)) With Transform(i) In Temp
EndFor
cStmt = ''
cStmtValues = ''
For i = 1 To MAX_FIELDS
cStmt = cStmt + ', Field' + Transform(i)
cStmtValues = cStmtValues + ', ?Temp.Field' + Transform(i)
EndFor
cStmt = 'Insert Into #Temp(' + Substr(cStmt, 3) + ') Values (' + Substr(cStmtValues, 3) + ')'
xSQLExec(cStmt)
USE In Temp
xSQLExec('Select Count(*) As Cnt From #Temp', 'Temp')
MessageBox('Records inserted : ' + Tran(Temp.Cnt))
USE In Temp
SQLDisconnect(nHandle)
Return
Function xSqlExec(cStmt, cCursor)
If Pcount() = 2
If SQLExec(nHandle, cStmt, cCursor) < 0
MessageBox(Message())
EndIf
Else
If SQLExec(nHandle, cStmt) < 0
MessageBox(Message())
Endif
EndIf
EndFunc
bye, Emanuele!
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.