Re: VB / SQL questions
Brian you get the big gold star today. I should probably have stated more exactly what the field name was. The only response, that is might have embedded spaces wasn't the case this time, but that wasn't the fault of the responder since I wasn't specific about what the field was. It was called MIN So I suppose that MIN is a keyword (minimum?) and now you have made it clear what my initial error was. Thanks. Will In a message dated 3/29/2004 5:41:22 AM Eastern Standard Time, [EMAIL PROTECTED] writes: > Just to add, > > And if they clash with SQL keywords like DATE, USER or STATUS. > So it's just generally safer to enforce them, as you never know what > keywords are likely to be added in the future. > > Brian > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Larry Hiscock > Sent: 26 March 2004 18:20 > To: U2 Users Discussion List > Subject: RE: VB / SQL questions > > > Can someone tell me why I need > > INSERT INTO test([field1], field2 > > instead of > > INSERT INTO test(field1, field2 -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
RE: VB / SQL questions
Just to add, And if they clash with SQL keywords like DATE, USER or STATUS. So it's just generally safer to enforce them, as you never know what keywords are likely to be added in the future. Brian -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Larry Hiscock Sent: 26 March 2004 18:20 To: U2 Users Discussion List Subject: RE: VB / SQL questions > Can someone tell me why I need > INSERT INTO test([field1], field2 > instead of > INSERT INTO test(field1, field2 Brackets are required around field and file names if they contain spaces or other non-alphanumeric characters. Larry Hiscock Western Computer Services http://www.wcs-corp.com -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users This email was checked by MessageLabs SkyScan before entering Microgen. This email was checked on leaving Microgen for viruses, similar malicious code and inappropriate content by MessageLabs SkyScan. DISCLAIMER This email and any attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information. In the event of any technical difficulty with this email, please contact the sender or [EMAIL PROTECTED] Microgen Information Management Solutions http://www.microgen.co.uk -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
RE: VB / SQL questions
> Can someone tell me why I need > INSERT INTO test([field1], field2 > instead of > INSERT INTO test(field1, field2 Brackets are required around field and file names if they contain spaces or other non-alphanumeric characters. Larry Hiscock Western Computer Services http://www.wcs-corp.com -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users
Re: VB / SQL questions
OK thanks for the heads up on using SQL INSERT and UPDATE instead of ADO Recordsets and also using the Prepared property. That made my program run about 7 times faster. Can someone tell me why I need INSERT INTO test([field1], field2 instead of INSERT INTO test(field1, field2 in other words what is the "[]" doing? I never saw that in any examples yet the SQL builder/browser thingie puts it in if I build the statement using it. AND putting it into my program fixed a nasty bug about SQL syntax. But... what is it doing? What does it mean? Also on a seperate note, here is a snippet of what I am doing and would appreciate any comments. Please realize this is only a snippet, not the whole program. Do I need that first open in order to set up cnn1? b = "Will" Set cnn1 = CurrentProject.Connection Set adocmd = New adodb.Command Set adocmd.ActiveConnection = cnn1 adocmd.Prepared = True openmsg$ = "Select * from test" Set rstTest = New adodb.Recordset rstTest.CursorType = adOpenKeyset rstTest.LockType = adLockBatchOptimistic rstTest.open openmsg$,cnn1 execmsg = "SELECT * from test where Field1 = '" & b "'" adocmd.CommandText = execmsg Set rstTest = adocmd.Execute() If rstTest.BOF = True then cntnew = cntnew + 1 *dostuff for new records Else cntold = cntold + 1 *dostuff for old records End -- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users