Advertisement
Advertisement
| 06.16.2008 at 12:00PM PDT, ID: 23489270 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: |
myReader.Close() 'Close connection string
'*****************************Add Rows to DataTable**********************************
Dim rowCt As Integer
Dim row1 As DataRow
'Dim ConnRecommendNew As New SqlConnection(Application("A1SConnString"))
'ConnRecommendNew.Open()
row1 = exDataTable.NewRow
For rowCt = 0 To i
row1 = exDataTable.NewRow()
row1("UPC") = exData(rowCt, 0)
row1("Order") = exData(rowCt, 1)
row1("Description") = exData(rowCt, 2)
row1("PK") = exData(rowCt, 3)
row1("SIZE") = exData(rowCt, 4)
row1("SALE QTY") = exData(rowCt, 5)
row1("SALE COST") = exData(rowCt, 6)
row1("CASE COST") = exData(rowCt, 7)
row1("DEAL") = exData(rowCt, 8)
row1("DEAL COST") = exData(rowCt, 9)
row1("UNIT QTY") = exData(rowCt, 10)
row1("UNIT COST") = exData(rowCt, 11)
row1("RETAIL") = exData(rowCt, 12)
row1("PAL") = exData(rowCt, 13)
row1("TIER") = exData(rowCt, 14)
row1("TRIP PTS.") = exData(rowCt, 15)
' Be sure to add the new row to the DataRowCollection.
exDataTable.Rows.Add(row1)
Next rowCt
''##################################################################
'' ****** Here saving to the Recommend table from datagrid
Dim ConnRecommendNew As New SqlConnection(Application("A1SConnString"))
ConnRecommendNew.Open()
' For Each row1 In DS.Tables(0).Rows
Dim UPC As String = row1("UPC").ToString()
Dim Description As String = row1("Description").ToString()
Dim ImportRecommend As New SqlCommand
ImportRecommend = ConnRecommendNew.CreateCommand
ImportRecommend.CommandType = CommandType.Text
ImportRecommend.CommandText = "Insert into SalesItems(Upc,Description) Values (@Upc,@Description)"
ImportRecommend.Parameters.Add("@Upc", SqlDbType.VarChar, 50).Value = UPC
ImportRecommend.Parameters.Add("@Description", SqlDbType.VarChar, 50).Value = Description
ImportRecommend.ExecuteNonQuery()
MyCommand = New System.Data.OleDb.OleDbDataAdapter(sqlStr, MyConnection)
MyCommand.TableMappings.Add("Table", "SalesBatch")
DataGrid1.DataSource = exDataTable
DataGrid1.DataBind()
ImportRecommend.Dispose()
' ConnRecommendNew.Close()
ConnRecommendNew.Close()
MyConnection.Close()
' Next
End Sub
|