Access and vb.net row adding 
Author Message
 Access and vb.net row adding

Please help.......

When attempting to add a row to an access database in a vb.net windows appI
keep getting the error:

An unhandled exception of type 'System.FormatException' occurred in
system.data.dll

Additional information: Input string was not in a correct format.

The access database has the following fields....
ID autonumber
CUSTNO  Text
ITEMNO Text
QTY number
PRICE Number
UM Text
TOTPRICE Number

All number fields are set to Long Integer Decimal Value Auto.
I am attempting to add a row to this database. If I convert the number
fields to integer, it works but it rounds the numbers.
Here is the code I used to try to send a new row:
(I was trying different things so it may not make sense any more :(
Dim drnew As dsordhold.ORDERSRow

drnew = Me.Dsordhold1.ORDERS.NewRow

drnew.Item("custno") = CStr(custno)

drnew.Item("itemno") = CStr(chitem)

drnew.Item("qty") = CInt(qtyinput)

drnew.Item("price") = CInt(selectedprice)

drnew.Item("UM") = CStr(UM)

drnew.Item("totprice") = CInt(qtyinput) * CInt(selectedprice)

Me.Dsordhold1.ORDERS.Rows.Add(drnew)

OleDbDataAdapter1.Update(Dsordhold1.ORDERS)

OleDbDataAdapter1.AcceptChangesDuringFill = True



Sat, 17 Sep 2005 08:28:15 GMT  
 Access and vb.net row adding
Are the Number values in the Access table Integers?
If so, you can't insert decimal values.
--
Joe Fallon
Access MVP


Quote:
> Please help.......

> When attempting to add a row to an access database in a vb.net windows
appI
> keep getting the error:

> An unhandled exception of type 'System.FormatException' occurred in
> system.data.dll

> Additional information: Input string was not in a correct format.

> The access database has the following fields....
> ID autonumber
> CUSTNO  Text
> ITEMNO Text
> QTY number
> PRICE Number
> UM Text
> TOTPRICE Number

> All number fields are set to Long Integer Decimal Value Auto.
> I am attempting to add a row to this database. If I convert the number
> fields to integer, it works but it rounds the numbers.
> Here is the code I used to try to send a new row:
> (I was trying different things so it may not make sense any more :(
> Dim drnew As dsordhold.ORDERSRow

> drnew = Me.Dsordhold1.ORDERS.NewRow

> drnew.Item("custno") = CStr(custno)

> drnew.Item("itemno") = CStr(chitem)

> drnew.Item("qty") = CInt(qtyinput)

> drnew.Item("price") = CInt(selectedprice)

> drnew.Item("UM") = CStr(UM)

> drnew.Item("totprice") = CInt(qtyinput) * CInt(selectedprice)

> Me.Dsordhold1.ORDERS.Rows.Add(drnew)

> OleDbDataAdapter1.Update(Dsordhold1.ORDERS)

> OleDbDataAdapter1.AcceptChangesDuringFill = True



Mon, 19 Sep 2005 08:35:39 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Adding a row to access database in vb.net

2. Adding a row to Access database using VB.Net

3. Disabling Add Rows in a DataGrid in VB.net

4. Need HaveDeleting Rows From an Access Table Using VB.Net Front End

5. asp.net DataGrid adding an extra Header Row

6. Accessing vb.net class from non.vb.net apps

7. Adding or Suppressing Top N Sort in Crystal.Net and VB.net

8. Add a row to a spreadsheet using a MS Access DDE-link

9. adding a table row, without setting same defaults as previous row

10. row heights of table rows added by vba

11. Add row to datatable from datagrid without leaving current row with cursor

12. ADO.NET DataSet.TableName.AddTableNameRow() inserts an extra row

 

 
Powered by phpBB® Forum Software