|
-
Dec 5th, 2006, 05:12 PM
#1
Thread Starter
Hyperactive Member
boolean values in an insert problem
I try to use this command:
Code:
Dim strSQL As String = "insert into Auto values('" & strVIN & "','" & strMake & "','" & strModel & "'," & intCatID & ",'" & strAutoYear & "'," & Math.Round(decAutoCost, 2).ToString & ",'" & RegExp.ToString & "'," & intISMiles & ",'" & ISDate.ToString & "','" & strStall & "'," & intCurrentMiles.ToString & "," & blnMntFlag.ToString & "," & blnDamageFlag.ToString & "," & blnRentable.ToString & ")"
which in this case builds this statement:
"insert into Auto values('A73jF72jhnf7','Yugo','Pimpmobile',5,'1977',100.00,'12/22/2006 4:08:23 PM',0,'12/5/2006 12:00:00 AM','A1',250000,False,False,True)"
and get this error:
The name "False" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
I could have sworn it took it in that form another time I did this. The table structure is in that order except the first column is, of course, the primary key which is an index so I left that out. It it getting confused and trying to put things in in the wrong order because of that? If so, how do I fix that. I totally need to fix it fast cuz I told myself I won't turn off this song on a loop until I fix this part of the project and it's Remind Me by Royksopp (from the Geico Airport Commercial) and it's gotta go real soon lol.
P.S. I'm using Microsoft SQL server and the last three column specs are bit
Last edited by Desolator144; Dec 5th, 2006 at 05:17 PM.
I tried to end process on Visual Studio 2005
but PETA stopped me saying it's smart enough
to be a living creature 
-
Dec 5th, 2006, 05:32 PM
#2
Re: boolean values in an insert problem
You should always specify the fieldnames, eg:
Code:
insert into Auto (field1, field2, ... fieldn) values('A73jF72jhnf7', ...
-
Dec 5th, 2006, 05:39 PM
#3
Thread Starter
Hyperactive Member
-
Dec 5th, 2006, 07:02 PM
#4
Addicted Member
Re: boolean values in an insert problem
What database are you using?
You can get round this, by using a stored procedure to perform the insert (provided of course the database allows this), and pass in parameters. Then you can pass in true / false and the stored procedure will translate to the relevant value.
JP
Please rate the postings 
-
Dec 5th, 2006, 07:06 PM
#5
Addicted Member
Re: boolean values in an insert problem
As an aside, back in 1990, myself and some colleagues were working on IBM 3090's. The company I worked with had 6 of them, and for disaster recovery purposes, they placed them in different sites. We were learning assembly programming, and one of my friends completed their program, it compiled and we ran it.
Somehow or another the program caused the mainframe to shut down, but being in a clustered environment, the other mainframes took over and one by one they all shut themselves down. It made for a very interesting day that day.
Seeing your picture reminded me of this.
JP
Please rate the postings 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|