Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Alright, I've got a table in Access that will let me update anything ... except for two fields, "Min" and "Max" ... here's the sql query as I define it in VB.Net: (ASPX pages, btw)

sqlQuery = "INSERT INTO ProcessPricing ( MaterialCode, Process, Min, Max, CostPerPound, RateMeasurement, RateAmount, MinimumCharge ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ? );"

I then define the parameters, etc. When I hit ExecuteNonQuery(), however, the application comes back saying that there's a syntax error in my INSERT INTO statement. I had the same problem when using UPDATE (minus the materialCode and Process fields), so I figured I could work around it by creating a new record (wrong!). I know it's the "Min" and "Max" fields through trial and error ... I basically tried updating each field separately until I hit the error again.

The problem is, these two fields are the Double data type in the database, and I can't tell what's causing the problem ... especially since RateMeasurement is in the same table, of the same data type, the whole bit!

Any ideas of what I might be overlooking?

 

Thanks in advance,

Turonah

Posted

Min and Max are keywords. . . not a good choice for field names. . .

min and max what????

 

to get around this put min and max in brackets. . .

[Min], [Max]

 

keep in mind the [FieldName] format is MS specific and might not work if your client chooses to go to another DB platform in the future.

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Posted

the only thing I can think of is that one of your datatypes is text.

 

so just take materialcode for instance. if that was a text then look at the value I added.

 

so all text you put single quotes around it and all numbers you don't.

 

 

sqlQuery = "INSERT INTO ProcessPricing ( MaterialCode, Process, Min, Max, CostPerPound, RateMeasurement, RateAmount, MinimumCharge ) VALUES ( 'hello', ?, ?, ?, ?, ?, ?, ? );"

Live as if you were to die tomorrow. Learn as if you were to live forever.
Gandhi
Posted

Joe Mamma, you hit the nail right on the head ... I had no idea that Min and Max were reserved SQL keywords (oops), especially since the names worked fine with ASP. Guess I'll have to change those field names :P

 

Thanks very much!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...