Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET VB.NET
I have the following "insert into" sql query in ms access, everything in the query is able to insert data in the table except "status".I dont know if i have misplaced the qoutes.
 
UPDATE [Staff] SET [Surname]='" & Surname(0) & "',[FirstName]='" & FirstName(0) & "',[Sex]='" & Sex(0) & "',[EmploymentNo]='" & EmploymentNo(0) & "'" & DateOfIssueString1 & ",[Yearofbirth]=" & YearOfBirth(0) & ",[EducationID]=" & EducationID(0) & ",[PositionID]=" & PositionID(0) & " " & CurrentPositionDateString1 & ",[Status]='" & Status(0) & "' WHERE [StaffID]=1 AND [DCID]=" & DCID & " "
            DAL.MyExecuteQuery(Sql)
Posted 9-Aug-12 8:16am
mayeso644
Edited 9-Aug-12 8:23am
(no name)19.4K
v2
Comments
Kenneth Haugland at 9-Aug-12 13:50pm
   
Missing ' in the PositionID parameters?
Wes Aday at 9-Aug-12 14:09pm
   
Would be easier to take this and paste it into a query in your access db.
Kschuler at 9-Aug-12 14:22pm
   
Are you getting an error or is it just not updating? Can you give us the exact string that is actually being used to query instead of this code? In other words, debug it and see what values are in each of those variables that you are concating or better yet, just quickwatch the whole string to see its final value.
mayeso at 9-Aug-12 15:24pm
   
its only the status value that is not updating, the rest is ok
Kschuler at 9-Aug-12 15:40pm
   
so what value are you trying to set it to?
mayeso at 9-Aug-12 15:46pm
   
thanks managed to solve it
mayeso at 9-Aug-12 15:45pm
   
solved it
AlluvialDeposit at 9-Aug-12 16:22pm
   
Your code is vulnerable for sql injections.. http://www.codeproject.com/Articles/425150/Beginners-guide-to-a-secure-way-of-storing-passwor#sqlinjections

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 DamithSL 445
1 Maciej Los 238
2 OriginalGriff 229
3 Zoltán Zörgő 190
4 BillWoodruff 120
0 OriginalGriff 7,969
1 DamithSL 6,139
2 Sergey Alexandrovich Kryukov 5,449
3 Maciej Los 5,309
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web03 | 2.8.141223.1 | Last Updated 9 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100