Advertisement
Advertisement
| 09.16.2008 at 03:05AM PDT, ID: 23734533 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
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: |
Public Function InsertCompany(ByVal dt As DataTable)
Dim i As Integer
Dim CustRow As DataRow
Dim dr(5000) As DataRow
Dim adapter As OleDbDataAdapter = New OleDbDataAdapter("SELECT * FROM Customers", Conn)
adapter.InsertCommand = New OleDbCommand("INSERT INTO Customers (SECID, BLOCK, ITEM, FY, V) VALUES(?, ?, ?, ?, ?);", Conn)
adapter.InsertCommand.Parameters.Add("@SECIDBLP", OleDbType.VarChar, 50, "SECID")
adapter.InsertCommand.Parameters.Add("@BLOCK", OleDbType.VarChar, 50, "BLOCK")
adapter.InsertCommand.Parameters.Add("@ITEM", OleDbType.VarChar, 50, "ITEM")
adapter.InsertCommand.Parameters.Add("@ITEM", OleDbType.Integer, 8, "FY")
adapter.InsertCommand.Parameters.Add("@V", OleDbType.Double, 8, "V")
adapter.AcceptChangesDuringFill = False
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
Dim dcmID As New DataColumnMapping("SECID", "SECID")
Dim dcmName As New DataColumnMapping("BLOCK", "BLOCK")
Dim dcmITEM As New DataColumnMapping("ITEM", "ITEM")
Dim dcmFY As New DataColumnMapping("FY", "FY")
Dim dcmV As New DataColumnMapping("V", "V")
Dim dtmTable As New DataTableMapping("Table", "Customers")
dtmTable.ColumnMappings.Add(dcmID)
dtmTable.ColumnMappings.Add(dcmName)
dtmTable.ColumnMappings.Add(dcmITEM)
dtmTable.ColumnMappings.Add(dcmFY)
dtmTable.ColumnMappings.Add(dcmV)
adapter.TableMappings.Add(dtmTable)
Dim custDS As DataSet = New DataSet()
adapter.Fill(custDS, "Table")
For i = 1 To dt.Rows.Count - 1
dr = dt.Select
CustRow = custDS.Tables(0).NewRow()
CustRow("SECID") = dr(i).Item(0).ToString
CustRow("BLOCK") = dr(i).Item(1).ToString
CustRow("ITEM") = dr(i).Item(2).ToString
CustRow("FY") = dr(i).Item(3)
CustRow("V") = dr(i).Item(4)
custDS.Tables(0).Rows.Add(CustRow)
Next i
Try
adapter.Update(custDS.GetChanges(), "Customers")
Catch ex As Exception
MessageBox.Show(ex.Message & " - " & ex.Source)
Conn.Close()
End Try
custDS.AcceptChanges()
End Function
|