Hi Axel,
I cannot replicate the error. I tried to execute more than once with different parameters but no error.
Are you able to create a sample minimal script in which you replicate the problem?
Thanks
Eros
Printable View
Hi Axel,
I cannot replicate the error. I tried to execute more than once with different parameters but no error.
Are you able to create a sample minimal script in which you replicate the problem?
Thanks
Eros
Hi Erol,
this is my example:
Thanks for your assist.Code:Uses "Console"
Uses "ADODB"
Dim pConnection As New ADODB_CONNECTION
Dim sConn As String
Dim sSql As String
'--------------------------------------------------------------
Function select_record(ByVal pconn As ADODB_CONNECTION, ByVal sSSS As String)
Dim pRS As New ADODB_RECORDSET
pRs.CursorLocation = %ADUSECLIENT
sSql = "select * from T_SSS where sss = " & "'" & sSSS & "';"
pRs.OPEN sSql, pConn, %ADOPENDYNAMIC, %ADLOCKOPTIMISTIC, %ADCMDTEXT
If pRS.State = %ADSTATEOPEN Then
PrintL "Sätze gefunden: " & pRs.RecordCount
End If
pRs.close
End Function
'----------------------------------
Function Add_New_Record(ByVal pConn As ADODB_CONNECTION, ByVal sISBN As String, ByVal lYear As Long, ByVal sTitle As String)
'----------------------------------
Dim pRS As New ADODB_RECORDSET
pRs.CursorLocation = %ADUSECLIENT
sSql = "select * from Titles where ISBN = " & "'" & sISBN & "';"
PrintL ssql
'pRS.Open "Titles", pConn, %ADOPENKEYSET, %ADLOCKOPTIMISTIC, %ADCMDTABLE
pRs.OPEN sSql, pConn, %ADOPENDYNAMIC, %ADLOCKOPTIMISTIC, %ADCMDTEXT
If pRS.State = %ADSTATEOPEN Then
PrintL pRs.RecordCount
If pRS.RecordCount = 1 Then
pRs.UpdateS("ISBN") = sISBN '& " " & Timer'"ich 4711"
pRs.UpdateN("Year Published") = lYear'2016
pRs.UpdateS("Title") = sTitle'"Mein erster satz"
pRs.update
'---To check if there is ana arror, always use connection and ErrorsCount method
If pConn.Errors.Count Then
PrintL "--> Fehler nach update" In %CCOLOR_FYELLOW
PrintL "Error number..:", pConn.Errors(1).Number
PrintL "Description...:", pConn.Errors(1).Description
PrintL "Source........:", pConn.Errors(1).Source
PrintL "SQLState......:", pConn.Errors(1).SQLState
PrintL "NativeError...:", pConn.Errors(1).NativeError
pConn.Errors.Clear
End If
PrintL "update" In %CCOLOR_FLIGHTRED
End If
If pRS.RecordCount = 0 Then
pRs.addnew
pRs.UpdateS("ISBN") = sISBN '& " " & Timer'"ich 4711"
pRs.UpdateN("Year Published") = lYear'2016
pRs.UpdateS("Title") = sTitle'"Mein erster satz"
pRs.UpdateS("PubID") = 69
pRs.update
'---To check if there is ana arror, always use connection and ErrorsCount method
If pConn.Errors.Count Then
PrintL "--> Fehler nach insert" In %CCOLOR_FYELLOW
PrintL "Error number..:", pConn.Errors(1).Number
PrintL "Description...:", pConn.Errors(1).Description
PrintL "Source........:", pConn.Errors(1).Source
PrintL "SQLState......:", pConn.Errors(1).SQLState
PrintL "NativeError...:", pConn.Errors(1).NativeError
pConn.Errors.Clear
End If
PrintL "insert" In %CCOLOR_FLIGHTRED
End If
PrintL " pRecordSet.Close :", pRS.CLOSE
End If
End Function
'---------------------------------------------------------------
' Connection
'---------------------------------------------------------------
'sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & APP_SourcePath & "biblio.mdb"
sConn = "Provider=sqloledb;Data Source=\\server\db;Initial Catalog=KNI2M;User Id=xxxxxx;Password=yyyyy ;"
'---Set connection string
pConnection.ConnectionString = sConn
' PrintL "-Connection------------------------------------------"
PrintL " Opening ..." , pConnection.OPEN'(sConn)
' PrintL " pConnection.Connectionstring:" , pConnection.Connectionstring
PrintL " pConnection.State :" , pConnection.State
PrintL " pConnection.Version :" , pConnection.Version
PrintL "-Press a key to continue------------------------------" In %CCOLOR_FYELLOW
'---To check if there is ana arror, always use connection and ErrorsCount method
If pConnection.Errors.Count Then
'---Show all errors in one go.
'---This function also clear internal errors collection
PrintL pConnection.Errors.Msg
End If
If pConnection.State = %ADSTATEOPEN Then
' Add_New_Record(pConnection, "999999900", 9999, "Axels Test " & Date$(2) & " " & Time$(0))
select_record(pConnection, "11000238")
select_record(pConnection, "11000237")
' PrintL "-Closing press a key-------------------------------------------" In %CCOLOR_FYELLOW
'WaitKey
PrintL " pConnection.Close :", pConnection.CLOSE
Else
PrintL "-It was not possible to open a connection-" In %CCOLOR_FLIGHTRED
End If
PrintL
PrintL "-Press a key to finish-------------------------------"
WaitKey
Axel
Ciao Axel,
got the same error, thanks.
I need more time to understand why, it is a parsing problem in thinBasic Core engine.
There are some "optimizations" during first execution of a function that are applied from the second execution on.
Obviously I've made some error in there :oops:
As a workaround, please try to add parenthesis to:
and change toCode:pRs.OPEN sSql, pConn, %ADOPENDYNAMIC, %ADLOCKOPTIMISTIC, %ADCMDTEXT
Here seems to work, let me know if it works also for you.Code:pRs.OPEN(sSql, pConn, %ADOPENDYNAMIC, %ADLOCKOPTIMISTIC, %ADCMDTEXT)
Ciao
Eros
Hi Eros,
first check works fine for me, many thanks for the workearound.
Axel
Hello Eros,
i have to insert a value , e.g. 58.58 in a database money field. I'm loosing the cent, the value in the database is 58.
i have test pRs.updateN, pRs.updateD and prs.updateD. Always the same result. Do you have any idea?
Thank you for your support.
Regards,
Axel
Here it seems working fine.
Attached an example with a BIBLIO.MDB Access DB in which I pass a numeric with 2 decimals and insert a new record with currency, long integer and double numeric field
Let me know if it works for you.
Eros
Just a wild shot from DB amateur - couldn't it be something related to regional settings for floating point separator character?
Petr
Dear All,
Please excuse my late reply. Yes at first I am searching in the locale setup values.
I have overlooked my own mistakes. It all works as expected if you do it right.
But thank you very much for your support.
Kind regards,
Axel
Great, happy it is working.
I'm going on to implement new features for this module because I'm also using it at work.
In next thinBasic updated it will be also fully documented.
Ciao
Eros
Hi Erol,
Some information for you. I have finished my first TB ADO Project. The program replaces a COBOL / ODBC application.
I have ~ 2200 LOC. The program converts up to 80000 records per run. The old program was running up to 80 minutes,
the new needs of this 20 minutes max.
fantastic :D
two things I have:
-If I have a wrong field name in pRS.update("xxx") I get no error message
-if eg. the target field in pRS.update is a string with 20 digits and I set a value with 15 digits I get no error and teh field value is not set
Thank you for your fantastic work!
kind regards,
Axel