Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Where.... it fits!

Status
Not open for further replies.

awalli6i

Programmer
Aug 20, 2001
4
AU
sSql = "Insert Into PRadd_Address (PRaddAddressLine1, PRaddAddressLine2)" _
& "Values ('" & Line1 & " ', '" & Line2 & "') Where PRaddPersonId = " & temp2 & " "


can any1 tell me whats wrong with this !

I am using it in VB6 to access an SQL database.
 

The only problem I found was the lack of space between the doulble quote and the keyowrd "Values." I also don't see the need for the trailing characters & " ". I modified the query as follows.
[tt]
sSql = "Insert Into PRadd_Address (PRaddAddressLine1, PRaddAddressLine2)" _
& " Values ('" & Line1 & "', '" & Line2 & "') Where PRaddPersonId = " & temp2
[/tt]
If this doesn't solve the problem then I suggest you tell us what happens when you run the query. Do you get an error message? If so please post it so we can know what we are dealing with.

Also, may I suggest posting SQL Server questions in the SQL Seever forum - forum183. The answers you recieve in the ANSI SQL forum may not always apply in SQL Server. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top