turonah Posted March 9, 2004 Posted March 9, 2004 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 Quote
Joe Mamma Posted March 9, 2004 Posted March 9, 2004 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. Quote 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.
techmanbd Posted March 9, 2004 Posted March 9, 2004 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', ?, ?, ?, ?, ?, ?, ? );" Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
turonah Posted March 10, 2004 Author Posted March 10, 2004 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! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.