Re: about insert data....
From: Bobby (bobby.saputra_at_epselindo.com)
Date: 08/06/04
- Next message: Al Reid: "Re: about insert data...."
- Previous message: Al Reid: "Re: about insert data...."
- In reply to: Al Reid: "Re: about insert data...."
- Next in thread: Al Reid: "Re: about insert data...."
- Reply: Al Reid: "Re: about insert data...."
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 6 Aug 2004 18:50:00 +0700
Thanks for your quick responce, Can you give me an example please?
thanks
"Al Reid" <areidjr@reidDASHhome.com> wrote in message
news:efzFnj6eEHA.2804@TK2MSFTNGP11.phx.gbl...
> "Bobby" <bobby.saputra@epselindo.com> wrote in message
news:es9kGN6eEHA.2896@TK2MSFTNGP11.phx.gbl...
> > Hi all...
> > Please help me, I just want to know,
> > Is It a must that if we want to insert new record, we must rs.open and
> > select the record first?
> > And which way do you prefer, user recordset command, like my ex, or
query
> > syntax?
> >
> > thanks for your answer.
> >
> >
> > Dim FCON As New ADODB.Connection
> > Dim fs As New ADODB.Recordset
> >
> > fs.Open "select * from forest", FCON, adOpenStatic, adLockOptimistic
> > fs.AddNew
> > fs(0) = UCase(SLNO)
> > fs(1) = UCase(empcode)
> > fs(2) = UCase(NAME)
> > fs(3) = DOB
> > fs(4) = dOJ
> > fs(5) = UCase(PWP)
> > fs(6) = DATES
> > fs(7) = UCase(DIRECT)
> > fs(8) = UCase(CAST)
> > fs(9) = UCase(EMPHW)
> > fs(10) = UCase(FIRST)
> > fs(11) = UCase(SECOND)
> > fs(12) = UCase(THIRD)
> > fs(13) = QUALIFICATION
> > fs(14) = PSAL
> > If REMARKS <> "" Then
> > fs(15) = UCase(REMARKS)
> > End If
> > fs.Update
> > Set fs = Nothing
> > Set FCON = Nothing
> >
> >
> Bobby,
>
> I would not even consider using a recordset to insert data into a table.
I would dynamically create an insert statement and execute
> it using the connection object.
>
> Actually, in most cases I would create a Stored Procedure to do the update
and execute the SP using an ADODB Command object and
> create the appropriate number of parameters. This would be the safest and
most reliable way of doing the data access.
>
> You do not state what database you are using, but this approach will work
with Access, MSSQL and Oracle.
>
> --
> Al Reid
>
> How will I know when I get there...
> If I don't know where I'm going?
>
>
- Next message: Al Reid: "Re: about insert data...."
- Previous message: Al Reid: "Re: about insert data...."
- In reply to: Al Reid: "Re: about insert data...."
- Next in thread: Al Reid: "Re: about insert data...."
- Reply: Al Reid: "Re: about insert data...."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|