oledb - VB.NET - Visual Foxpro OLE DB Problem with Numeric Decimal Column -


in short: i'm using vb.net 2008 connect visual foxpro 6 database using vfpoledb.1 driver. when attempt fill oledbdataadapter dataset table contains 1 of numeric columns, following error message: "the provider not determine decimal value. example, row created, default decimal column not available, , consumer had not yet set new decimal value." i'd retrieve column vb.net 2008 , keep in numeric format.

the long version:

i'm using vb.net connect visual foxpro 6 database. several of columns in table intended numeric data type of 8 digits. i'm not sure how visual foxpro data types work appears field allows enter of following example values:

99999999   99999.99       9.99       9.00 {nothing}  

from visual foxpro: have access small program called foxwin allows me browse vfp tables in native vfp environment. i'm using access data obtain examples posted above. here can see rows contain no values @ in field although appear filled spaces when there no data. i've tried run update queries fill in every row valid data update queries finish without updating rows. i've tried isnull(bal_qty) , bal_qty null , neither 1 works.

from ms access 2007: using same driver i'm using in vb.net , can load ado recordset , bind form without problem. decimal values appear stripped off, because of them ".00". prefer build small program in vb.net i'm using ms access testing.

from vb.net: sql statement works if convert bal_qty string causes sort problems. i've tried val(str(bal_qty)) , fails same error message i've posted above. here's code i'm using:

imports system.data.oledb  public class form1     dim sconstring string = "provider=vfpoledb.1;data source=c:\mydatabase.dbc;mode=3;"     dim con oledbconnection = new oledbconnection(sconstring)      private function fetchdata()          con.open()         dim ds dataset = new dataset()         dim ssql string         'this sql statement works data doesn't sort properly.         'ssql = "select item_cd, item_desc, str(bal_qty) invent;"          ssql = "select item_cd, item_desc, bal_qty invent;"          dim cmd oledbcommand = new oledbcommand(ssql, con)         dim dainv oledbdataadapter = new oledbdataadapter(cmd)         dim ireccount integer         ireccount = dainv.fill(ds, "invent") 'the error occurs here.         me.datagridview1.datasource = ds.tables("invent").defaultview     end function      private sub btnfetchdata_click(byval sender object, byval e system.eventargs) handles btnfetchdata.click         call fetchdata()     end sub      private sub form1_formclosing(byval sender object, byval e system.windows.forms.formclosingeventargs) handles me.formclosing         con.close()         con = nothing     end sub end class 

we have problem .net app reads foxpro dbf's. our solution use following in select statement:

select propertyid, val(str(saleamt)) saleamt mytable 

this converts decimal column (saleamt) string , numeric value. additionally, if integer desired, can use int(saleamt) in select statement.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -