Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get rows from SalesOrderDetail Table to Datagrid?

Status
Not open for further replies.

sai1234ram

Programmer
Mar 16, 2008
9
IN
Dear Team
I am doing customization using MAS90 Erp in Vb.net. I am trying to get datas from Sales Order Detail table into a Datagrid. Here I want to bring all the Rows which corresponds to the SalesOrderNo. But I can get only one row into the Datagrid (Say for an example an Order No contains 5 rows). Here I have written Looping for Row increment. But It doesnt work. See below the codings.

Dim intRow As Integer
Dim ItemCode As String = ""
Dim ItemCodeDesc As String = ""
Dim QuantityOrdered As Decimal = 0

For intRow = 0 To oSOOrder.oLines.nMoveLast()
retVAL = oSOOrder.oLines.nGetValue("ItemCode$", ItemCode)
retVAL = oSOOrder.oLines.nGetValue("ItemCodeDesc$", ItemCodeDesc)
retVAL = oSOOrder.oLines.nGetValue("QuantityOrdered", QuantityOrdered)

Next

Dim NewLine As DataRow = MyDataTable.NewRow

NewLine(0) = ItemCode
NewLine(1) = ItemCodeDesc
NewLine(2) = QuantityOrdered

MyDataTable.Rows.Add(NewLine)

Here i am trying to access all the rows from SalesOrderDetail Table for a particular Order No. But only one row is read and added to the Datagrid. Is there any Methods and properties to Count the rows from the table. Kindly help me to correct it.

Regards
Kaliprasanna
ramprasna@gmail.com
 
I ran into something similar when trying to get results out of Mas 90. There is a delimiting character that you need to use to separate out the records. This is what I use to loop through a results set from Customer Records and look for a matching e-mail address.

Dim strResults
Dim strJunk

oARCustomerEntry.nGetResultSets("Emailaddress$", "Customerno$", strResults, strJunk, "", "", "")

Dim strResultsArray = Split(strResults, Chr(138))
Dim strResultsArrayKey = Split(strJunk, Chr(138))

Dim nextCustomerNumber = ""
Dim x = ""
Dim y = 0

For Each x In strResultsArray
If x = tmpEmail Then
nextCustomerNumber = strResultsArrayKey(y)
Exit For
End If
y = y + 1
Next


What I did to figure that out since I still don't have a list of methods and their properties, which if you have by the way and could send me I would be eternally grateful alistek at gmail.com, is use MsgBox commands to print out the data in the nGetResultsSet and figured out what the common delimiter is, the Chr(138), and split that. I get an array then which I am sure you could use to populate the DataGrid.

-Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top