Re: ADO Recordset Question

From: Brett S. (BrettS_at_discussions.microsoft.com)
Date: 02/02/05


Date: Wed, 2 Feb 2005 07:29:11 -0800

Thanks Chris. This is very helpful. I also discovered last night how to
accomplish this task by using variables and putting them into a string of SQL
syntax to be exectued. However, this may be a cleaner way to accomplish this
task.

"Chris2" wrote:

>
> >
> > Brett S.,
> >
> > Aircode/Pseudocode ("With" block omitted for brevity), obviously
> > untested.
> >
> > Open Recordset1
> > Open Recordset2
> > rs1.MoveFirst
> > Do Until rs1.eof
> > rs2.AddNew
> > rs2.Fields("Emp_No") = rs1.Fields("Emp_No")
> > rs2.Fields("EventType") = rs1.Fields("EventType1")
> > rs2.Fields("EventType") = rs1.Fields("EventTypeDate1")
> > rs2.update
> > rs2.AddNew
> > rs2.Fields("Emp_No") = rs1.Fields("Emp_No")
> > rs2.Fields("EventType") = rs1.Fields("EventType2")
> > rs2.Fields("EventType") = rs1.Fields("EventTypeDate2")
> > rs2.update
> > etc.
> >
> > rs1.MoveNext
> > Loop
> > rs1.close
> > rs2.close
> > rs1 = nothing
> > rs2 = nothing
> > etc.
> >
> > If the number of columns involved in the de-normalized table is
> > excessive, then put the .AddNew/.Update segment inside a loop, put
> > string variables into the .Fields Properties of rs1,
> > "rs1.Fields(strColumnName)", and then change the names of the fields
> > programmatically via string manipulation, or even referrencing the
> > columns by number, if there's a controllable pattern.
> >
> >
> > Sincerely,
> >
> > Chris O.
> >
> >
>
> Yes, there is a typo, I forgot to change the EventType to EventDate in
> the third line of the .AddNew/.Update segments.
>
>
>



Relevant Pages

  • Re: alternating string replace
    ... so that I get a new string like the following: ... Is there a common recipe to accomplish that? ... ## Program by: Chris ...
    (comp.lang.python)
  • Full Text Search across multiple tabels in SQL 2005/2008
    ... We have a requirement where we need to do full text search for a given string ... overhead of maintaining this table in sync with creates and updates on the ... Is there any other way to accomplish this in SQL 2005/2008? ...
    (microsoft.public.sqlserver.fulltext)
  • Save various objects. Please, need advice ... Thanks
    ... LOCALIZED content in an SQL 2005 database. ... This content might be a string, an integer, a class, a control, ... ... What SQL 2005 datatype should I use to accomplish this? ... I am still a little bit confused of how to accomplish this. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: simple binding of controls to object properties - refresh cont
    ... Thanks again Chris for looking into this.! ... Still I think I prefer just manually reseting the bindings, ... public string Ting ... textbox BobTheBound = new TextBox; ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: new for regular expression in Perl
    ... > string, the original file will not change.) ... >> Thanks Chris and others for the information. ... DSL? ...
    (perl.beginners)

Loading