Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Crispy

VB

This topic is 5844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Why does this: NewData As String NewData = "data" strSQL = "Insert into TTable (TField) Values (" & conQuote & NewData & conQuote & ")" produce this: "Insert into TTable (TField) Values (data)" not this: "Insert into TTable (TField) Values (''data'')" , which is the correct one. Thanks, Crispy

Share this post


Link to post
Share on other sites
Advertisement
Why don''t you just type:

strSQL = "Insert into TTable (TField) Values (''" & NewData & "'')"

?

It gets ''funny'' to look at when you have more than one field but it works.

One way I''ve done it for one of my systems was this:



  
DB_SQL = "select * from Collection where serialnumber = ''" & SerialNumber & "''"
Set DB_RetrieveSN_DB = DB_database.OpenRecordset(DB_SQL) ''Open SQL Statement 1

If DB_RetrieveSN_DB.EOF Then ''check to see if serial number is not in database
DB_database.Execute _
"insert into Collection(serialnumber, date_load) values(''" _
& SerialNumber & "'',''" & CollectionDate.Text & "'')"
Else
DB_database.Execute _
"update Collection set date_load = " & CollectionDate.Text & _
" where serialnumber = ''" & SerialNumber & "''"
End If

Share this post


Link to post
Share on other sites
It took me a while to admire your profound solution. Brrr... It''s just that I''m a VB n00b and I''m not at all comfortable with the concept yet - especially the ampersands.

Thanks a bunch, anyway - helped me out there!

PS - Access sample code uses the conQuote solution - it seems to be working for them.

Crispy

Share this post


Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!