Access Table with Integer fields Price , Amount def as double Coversion problem
Posted: Sat Mar 09, 2019 8:19 am
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 )
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 )