Rajkumar R

Rajkumar R

  • NA
  • 183
  • 219.5k

How to convert varchar to numeric

Dec 29 2011 2:05 AM
Dim cmdinsert As New SqlCommand("insert into VMIS_30(RptUnitTypeID,Rpt_Unit,YYYYMM,pipno,name1,clt,savings,typ_loan,amt,no_installme,rate_interest,randm_code)values('" + dr("UNITTYPE") + "','" + dr("VPRCID") + "'," + dr("YYYYMM") + ",'" + repipcode + "','" + dr("NAMEOFTHEMEMBER") + "','" + shgcode + "'," + dr("SAVINGS") + ",'" + dr("TYPELOAN") + "'," + dr("AMOUNT") + "," + dr("NOOFINSTALLMENT") + "," + dr("RATEOFINTEREST") + "," + rancode1.ToString() + ")", conDB)
 From the above statement i want convert this(" + dr("SAVINGS") + ") from varchar to numeric
here i m getting data from XML file, then i m importing into database. Here the savings field i m getting null value from XML FILE but in the backend(sqlserver) savings field defined as numeric. While i try to insert null value into DB i m getting error (ie., error converting datatype) so i need to convert here from varchar to numeric
Sorry for interrupt
Post solution for this post 
Thanks in advance



Answers (3)