Re: about insert data....

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bobby (bobby.saputra_at_epselindo.com)
Date: 08/06/04


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?
>
>



Relevant Pages

  • Re: about insert data....
    ... > Set FCON = Nothing ... I would dynamically create an insert statement and execute ... in most cases I would create a Stored Procedure to do the update and execute the SP using an ADODB Command object and ... This would be the safest and most reliable way of doing the data access. ...
    (microsoft.public.vb.database.ado)
  • Problems with remoting and SqlCommand.ExecuteNonQuery
    ... I´m having problems with a .net remoting application. ... is a data access component, in other words, it performs data access tasks. ... The problem arise when I try to execute a database task which involves the ... Could not establish a secure channel for ...
    (microsoft.public.dotnet.framework.remoting)
  • Combo box on data access page only showing one column
    ... I've created a data access page and one of the elements ... as soon as I execute the data ... Gyro ... Prev by Date: ...
    (microsoft.public.access.dataaccess.pages)
  • running a macro from within a DAP - Data Access Page
    ... Does anybody know how to execute a macro from a Data Access Page? ... How do I execute macros from within DAPs? ...
    (microsoft.public.access.macros)