asp.net - using VB

NiKeFiDO

Diamond Member
May 21, 2004
3,901
1
76
any ideas on why im getting this? im racking my brain !


ive tested sqlstr alone and it works, its in the INSERT statement that is giving me the problems. I have another insert statement used on another button that works fine with similar code :(
 

SelArom

Senior member
Sep 28, 2004
872
0
0
www.djselarom.com
it looks like you're missing a the single quotes around userident, and it also looks like there's an extra single-quote after that last parenthesis that shouldn't be there:

-SelArom
 

NiKeFiDO

Diamond Member
May 21, 2004
3,901
1
76
i fixed the last thing there, but the userident shouldnt be a string .. however it might be depending on how i initialized it...ill check it out!
 

NiKeFiDO

Diamond Member
May 21, 2004
3,901
1
76
nope - i kept the single quote off of userident and made userident = val(Me.lblid.Text) so it isnt a string -

still get that error.
 

SelArom

Senior member
Sep 28, 2004
872
0
0
www.djselarom.com
hmm well I don't remember my sql that well but the error message you're receiving is telling you that you constructed your sql INSERT statement incorrectly. are you sure there shouldn't be single-quotes around each value? (i don't remember my sql that well!)

I recommend you use the oledbcommand instead of just a raw insert string. look at the documentation on that...

basically you make a new oledbcommand object and make the commandtext something like "INsERT INTO ADMIN(column1, column2, column3) VALUES (?, ?, ?)"

then you'll manually add each strongly-typed parameter:

oledbcommand.parameters.add("column1", value1textbox.text)

it's a cleaner, less error prone way of issuing commands through ADO.NET.

hope that is helpful!

-SelArom
 

NiKeFiDO

Diamond Member
May 21, 2004
3,901
1
76
it would if i knew how :(

my teacher isnt the best for this class...its not just asp.net, we are only learning it at the end of the semester :(

ill see what i can do.
 

SelArom

Senior member
Sep 28, 2004
872
0
0
www.djselarom.com
Originally posted by: NiKeFiDO
it would if i knew how :(

my teacher isnt the best for this class...its not just asp.net, we are only learning it at the end of the semester :(

ill see what i can do.

I'd be happy to give you more detailed help if you're willing to email me your project so I can have a closer look at what's going on in there. sent it to josh at selarom dot com

-SelArom
 

MajorMullet

Senior member
Jul 29, 2004
816
4
81
The error message is a SQL Server error. Put a break point on the line after you set the INSERT statement so you can see what the SQL string that's going to the database looks like. Then you can go into query analyzer and run it there to fix the error.

If userident is supposed to be numerical then it shouldn't have apostrophes around it, otherwise it should.