Click here to Skip to main content
15,899,754 members
Home / Discussions / Database
   

Database

 
GeneralRe: quering on views Pin
blankg16-Jul-04 0:27
blankg16-Jul-04 0:27 
GeneralRe: quering on views Pin
Mekong River17-Jul-04 4:53
Mekong River17-Jul-04 4:53 
GeneralRe: quering on views Pin
blankg17-Jul-04 9:51
blankg17-Jul-04 9:51 
GeneralRe: quering on views Pin
Mekong River17-Jul-04 18:18
Mekong River17-Jul-04 18:18 
GeneralRe: quering on views Pin
blankg17-Jul-04 21:35
blankg17-Jul-04 21:35 
GeneralInput string was not in a correct format Pin
DotNet15-Jul-04 18:27
DotNet15-Jul-04 18:27 
GeneralRe: Input string was not in a correct format Pin
Colin Angus Mackay15-Jul-04 22:19
Colin Angus Mackay15-Jul-04 22:19 
GeneralRe: Input string was not in a correct format Pin
Colin Angus Mackay16-Jul-04 2:22
Colin Angus Mackay16-Jul-04 2:22 
From the email that you sent me the appropriate line appears to be:
UpdateCommand.Parameters.Add("@Price", SqlDbType.Decimal, 9).Value = hprice

But only if the textbox used to populate hprice (which you mentioned in your previous post) contains a value that cannot be interpreted as a decimal.

As I've already mentioned, you need to perform validation on the user input to ensure that invalid and nonsense values are rejected properly. As this is a price, I would guess that the only valid characters are the numeric characters and the decimal point (or comma - depending on your locality)

One easy way around this to perform the conversion yourself, then pass the converted value as the parameter. Wrap the conversion in a try catch block so that if the input from the user is incorrect you can catch it and report to the user their input is incorrect.

Decimal convertedHPrice = Convert.ToDecimal(hprice);

UpdateCommand.Parameters.Add("@Price", SqlDbType.Decimal, 9).Value = convertedHPrice 


Does this help?


"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell

The Second EuroCPian Event will be in Brussels on the 4th of September

Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!


GeneralRe: Input string was not in a correct format Pin
DotNet16-Jul-04 3:57
DotNet16-Jul-04 3:57 
Questioncan i get some operation infomation from SQLsrv2k ? Pin
fu015-Jul-04 15:58
fu015-Jul-04 15:58 
AnswerRe: can i get some operation infomation from SQLsrv2k ? Pin
RichardGrimmer15-Jul-04 23:28
RichardGrimmer15-Jul-04 23:28 
GeneralRe: can i get some operation infomation from SQLsrv2k ? Pin
fu017-Jul-04 15:39
fu017-Jul-04 15:39 
GeneralRe: can i get some operation infomation from SQLsrv2k ? Pin
RichardGrimmer19-Jul-04 5:40
RichardGrimmer19-Jul-04 5:40 
QuestionIs This Complex Update Possible? Pin
perlmunger15-Jul-04 11:38
perlmunger15-Jul-04 11:38 
AnswerRe: Is This Complex Update Possible? Pin
Colin Angus Mackay15-Jul-04 12:03
Colin Angus Mackay15-Jul-04 12:03 
GeneralRe: Is This Complex Update Possible? Pin
perlmunger15-Jul-04 12:21
perlmunger15-Jul-04 12:21 
GeneralRe: Is This Complex Update Possible? Pin
Colin Angus Mackay15-Jul-04 12:29
Colin Angus Mackay15-Jul-04 12:29 
GeneralRe: Is This Complex Update Possible? Pin
perlmunger15-Jul-04 12:39
perlmunger15-Jul-04 12:39 
GeneralRe: Is This Complex Update Possible? Pin
perlmunger15-Jul-04 13:02
perlmunger15-Jul-04 13:02 
GeneralRe: Is This Complex Update Possible? Pin
Colin Angus Mackay15-Jul-04 13:07
Colin Angus Mackay15-Jul-04 13:07 
AnswerRe: Is This Complex Update Possible? Pin
dishanf19-Jul-04 1:57
dishanf19-Jul-04 1:57 
GeneralRe: Is This Complex Update Possible? Pin
dishanf19-Jul-04 2:03
dishanf19-Jul-04 2:03 
GeneralWhat's wrong with this script from a Wrox Book Pin
mtbjr15-Jul-04 2:18
mtbjr15-Jul-04 2:18 
GeneralRe: What's wrong with this script from a Wrox Book Pin
Michael Potter15-Jul-04 5:23
Michael Potter15-Jul-04 5:23 
GeneralRe: What's wrong with this script from a Wrox Book Pin
Steven Campbell15-Jul-04 7:01
Steven Campbell15-Jul-04 7:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.