Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Input string was not in a correct format
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
01127603
Message ID:
01127617
Vues:
11
>>Could you show your code here, and the exact value you wish to insert?
>>
>>>I have a price variable that is decimal and I am trying to insert it into a table whose price field is numeric 7,2 but I keep getting "Input string was not in a correct format". I have this app setup ASP using VFPOLEDB.
>
>sure, it's done in VB.
>
>Public zprice As Decimal
> zprice = CDec(GridView2.Rows(0).Cells(2).Text)
>
> SqlDataSource1.InsertCommand = "insert into trans2 (office,date,name,detail,noun,price) values ('" + zoffice + "', '" + zdate + "', '" + zname + "', '" + zdetail + "', '" + znoun + "', '" + zprice + "')"
>
>
>To test my logic and syntax, I changed both var and table structure to char and it worked perfectly. But not with numeric. :-(

You try to put a string variable in Numeric field :-)
Remove single quotes before and after zprice (assuming this is the numeric field):
SqlDataSource1.InsertCommand = "insert into trans2 (office,date,name,detail,noun,price) values+ _
('" + zoffice + "', '" + zdate + "', '" + zname + "', '" + zdetail + "', '" + znoun + "', " + zprice + ")"
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform