Can someone please help me regarding this problem I am pasting the code in here
LOCAL cSelect,cSelectString := "" AS STRING
LOCAL cWhere AS STRING[]
LOCAL i, nLen AS INT
LOCAL cWhereClause := "" AS STRING
LOCAL cTemp AS STRING
LOCAL GridBackColor AS Color[]
LOCAL rdr AS OledbDataReader
LOCAL cStatement1 AS STRING
LOCAL cStatement2 AS STRING
LOCAL cmd AS OledbCommand
LOCAL dt AS DataTable
LOCAL AS400Lib AS STRING
LOCAL cTable,tablename,Table AS STRING
LOCAL cMenge AS STRING
LOCAL cPosPreis AS STRING
LOCAL cEPObj AS OBJECT
LOCAL cPosObj AS OBJECT
tablename := "OrdPos"
gSelect := "Select Pos,OrdPos,Artikel,Menge,Einheit,Kurztext,Postext,Preis,CreationDate From OrdPos where ServiceOrder = "+gServiceOrder+""
SELF:ds := Dataset{}
SELF:da := OledbDataAdapter{gSelect,oConn1}
cSelectString := gSelect
cmd := OledbCommand{cSelectString,oConn1}
*rdr := cmd:ExecuteReader(commandbehaviour.CloseConnection)
*rdr := cmd:connection.Open();
*dt:Load(rdr)
*oConn1:Open()
*dtZiel := dt:Clone()
*da:Update(dtZiel)
rdr := cmd:ExecuteReader()
cmd:CommandTimeout := 1 * 60 * 60
i := 0
DO WHILE rdr:Read()
*messagebox.show(gSelect)
gPos := rdr["Pos"]:Tostring()
gArtikel := rdr["Artikel"]:Tostring()
cMenge := rdr["Menge"]:ToString()
gEinheit := rdr["Einheit"]:ToString()
*gItemDesc := gItemDesc:replace("'", "")
*gOrdPos := rdr["OrdPos"]:Tostring()
gKurztext := rdr["Kurztext"]:ToString()
gPostext := rdr["Postext"]:ToString()
How can I get the FIELD EPPreis price defined AS double
IN the OrdPos Table converted to a string field or numeric field
without crashing AS an error. I am trying TO RECOVER it AS an OBJECT
also with problems.
cEPObj := rdr["EPPreis"]
IF cEPObj != NULL
gEKPreis := Convert.ToDouble(cEPObj)
ELSE
gEKPreis := 0
ENDIF
*cPosPreis := rdr["PosPreis"]:ToString()
Messagebox.show(gPos)
Messagebox.show(gArtikel)
Messagebox.show(gOrdPos)
Messagebox.show(gKurztext)
Messagebox.show(gPostext)
* messagebox.show(cMenge)
* messagebox.show(cEPPreis)
* messagebox.show(cPosPreis)
/*
messagebox.show(gArtikel) //:Replace("""","""""")
messagebox.show(gEinheit)
messagebox.show(gOrdPos)
messagebox.show(gPostext)
messagebox.show(gEPPreis)
*InsertFile()
*/
i++
// Call Close when done reading. , MORD,ItemNr, ItemDesc,New_ItemNr, .First_SerialNr, Warehouse, CurrentStatus, QTYIssued, QTYRequired, OperationNo, Releasedat
*rdr:close()
ENDDO
messageBox.show("Read End für ServiceOrder = " +gServiceOrder )
Access Table with Integer fields Price , Amount def as double Coversion problem
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
Access Table with Integer fields Price , Amount def as double Coversion problem
What IS EPPreis in your table?
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
Access Table with Integer fields Price , Amount def as double Coversion problem
Hi My name is Raymond Warner
I was first introduced to Vo a long time ago when I was working as an IT Manager for several Companies I then also worked a lot with Dieter Crispien here in Germnay who brought me further using Vo and then introducing me to Vulcan we did several Projects together . I also worked with John Parker on several projects. Anyway I have mo more contact with Dieter and was looking for the latest version of Vulcan and stumbled upon X#. Because I am familiar with the language and used Vulcan a lot I am now interested in doing my current Projects which I have started to programe in X#. I am a huge fan of VO and Vulcan and would like to carry on using X# as the next generation software I am also looking at Python/ Ironpython and have started small programes with Python and Ironpython an interface between X# and Python would be great.
I am happy to be a part of the X# Community
Best Regards
Raymond Warner
I was first introduced to Vo a long time ago when I was working as an IT Manager for several Companies I then also worked a lot with Dieter Crispien here in Germnay who brought me further using Vo and then introducing me to Vulcan we did several Projects together . I also worked with John Parker on several projects. Anyway I have mo more contact with Dieter and was looking for the latest version of Vulcan and stumbled upon X#. Because I am familiar with the language and used Vulcan a lot I am now interested in doing my current Projects which I have started to programe in X#. I am a huge fan of VO and Vulcan and would like to carry on using X# as the next generation software I am also looking at Python/ Ironpython and have started small programes with Python and Ironpython an interface between X# and Python would be great.
I am happy to be a part of the X# Community
Best Regards
Raymond Warner
Access Table with Integer fields Price , Amount def as double Coversion problem
Raymond,
This should work for string conversions:
cEPObj := rdr["EPPreis"]:ToString()
And from the string you can then use this
LOCAL doubleValue as System.Double // you can also use REAL8
IF System.Double.TryParse(cEPObj, OUT doubleValue)
ENDIF
Robert
This should work for string conversions:
cEPObj := rdr["EPPreis"]:ToString()
And from the string you can then use this
LOCAL doubleValue as System.Double // you can also use REAL8
IF System.Double.TryParse(cEPObj, OUT doubleValue)
ENDIF
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
Access Table with Integer fields Price , Amount def as double Coversion problem
EPPreis is a field in the Ordpos Table it means position price for an item
EKPreis is buying price
Epospreis is the total postionprice
They are defined as double and 2 decimal positions
EKPreis is buying price
Epospreis is the total postionprice
They are defined as double and 2 decimal positions
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
Access Table with Integer fields Price , Amount def as double Coversion problem
Hi Robert,
Sorry for the delay I was checking out what you told me to do.
Robert my field is a Double in the Access table
I want to convert it when I use the rdr to the field to string I then get an error
cEPPreis := rdr["EPPreis"]:ToString()
EPPreis is a field defined as string EPPreis is a field defined as aDouble in the access table
Sorry for the delay I was checking out what you told me to do.
Robert my field is a Double in the Access table
I want to convert it when I use the rdr to the field to string I then get an error
cEPPreis := rdr["EPPreis"]:ToString()
EPPreis is a field defined as string EPPreis is a field defined as aDouble in the access table
Access Table with Integer fields Price , Amount def as double Coversion problem
Which error? "an" is a bit vague
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
-
- Posts: 46
- Joined: Mon Mar 04, 2019 4:41 pm
Access Table with Integer fields Price , Amount def as double Coversion problem
Hi Robert,
I made a big mistake the fields are missing in the select stastement sorry for the bother How do I close this
Again very sorry foir my mistake.
Raymond
I made a big mistake the fields are missing in the select stastement sorry for the bother How do I close this
Again very sorry foir my mistake.
Raymond
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Access Table with Integer fields Price , Amount def as double Coversion problem
Hi Raymond,
Welcome I see you already seeing how quick and willing people are to assist.
If you know the type of the object you can cast it with the syntax:
Welcome I see you already seeing how quick and willing people are to assist.
The easiest if you know the type of your Field in the database table is:rn@warner-it.com wrote:Can someone please help me regarding this problem I am pasting the code in here
Code: Select all
LOCAL dEPPreis AS Real8
rdr := cmd:ExecuteReader()
DO WHILE rdr:Read()
...
dEPPreis := (Real8)rdr["EPPreis"]
Code: Select all
(TypeToCastTo)obj
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa
- lumberjack
- Posts: 727
- Joined: Fri Sep 25, 2015 3:11 pm
- Location: South Africa
Access Table with Integer fields Price , Amount def as double Coversion problem
Raymond,
Glad you got it sorted!
Keep in touch on the forums,
Don't be sorry, we all human, we all make (programming)mistakes.rn@warner-it.com wrote:Hi Robert,
I made a big mistake the fields are missing in the select stastement sorry for the bother How do I close this
Again very sorry for my mistake.
Glad you got it sorted!
Keep in touch on the forums,
______________________
Johan Nel
Boshof, South Africa
Johan Nel
Boshof, South Africa