2 fairly simple database Qs 
Author Message
 2 fairly simple database Qs

Hi,

Here's a couple of easy ones.  I'm just hoping there's a better way.

1.  Remember the old .DBF files...Remember the Zap command.  It blew out all
the data in the table without destroying its structure.  Is there an
equivelant function in VB6 with ADO or DAO.  What I've been doing is the
old:
    rs.delete
    rs.movenext
Wend

This can be slow at times and seems like it can't be the only way.

2. I populate a recordset from something other than a table.  However I need
to put this records in this recordset into a table.  Once again there has to
be a better way than for each record doing the:
    rs.fields!field1 = bla, bla, bla

Can't I just say parse the record into this record, etc.

Thanks,

Jason



Sat, 01 Jun 2002 03:00:00 GMT  
 2 fairly simple database Qs
Jason,

For #1, how about this?

   Dim sdbCurrent As Database
   Set sdbCurrent = CurrentDb()
   Dim strQuery
   strQuery = "DELETE * FROM " & strTableName
   sdbCurrent.Execute [strQuery]

strTableName holds the name of the table in the current database you want to
ZAP!!

(And you abandoned Fox? Say it ain't so!)

For #2 - yeah, that's about it. What I'm suggesting is a FoxPro solution, may
not work in Access, but it might lead to something. Can you get the data into an
array which matches the structure of the table?

If so, for each record you import UPDATE TableName from Array, or, do an INSERT
INTO.

If not, it may be faster to loop through the array ...

For each record I want to import
   Copy the data to an array
   For nFieldIndex = 1 to arraylength
          rs.fields( nFieldIndex) = array( nFieldIndex)
  Next
Next

I gotta say it -- have you looked at Visual FoxPro lately? It's a fabulous
development environment, and still blazing fast.

Regards - Miles Thompson
CQA Consulting Group, Enfield, NS Canada

Quote:

> Hi,

> Here's a couple of easy ones.  I'm just hoping there's a better way.

> 1.  Remember the old .DBF files...Remember the Zap command.  It blew out all
> the data in the table without destroying its structure.  Is there an
> equivelant function in VB6 with ADO or DAO.  What I've been doing is the
> old:
>     rs.delete
>     rs.movenext
> Wend

> This can be slow at times and seems like it can't be the only way.

> 2. I populate a recordset from something other than a table.  However I need
> to put this records in this recordset into a table.  Once again there has to
> be a better way than for each record doing the:
>     rs.fields!field1 = bla, bla, bla

> Can't I just say parse the record into this record, etc.

> Thanks,

> Jason



Sat, 01 Jun 2002 03:00:00 GMT  
 2 fairly simple database Qs
...  but leave the asterisk out of the delete statement.

Quote:

>Jason,

>For #1, how about this?

>   Dim sdbCurrent As Database
>   Set sdbCurrent = CurrentDb()
>   Dim strQuery
>   strQuery = "DELETE * FROM " & strTableName
>   sdbCurrent.Execute [strQuery]

>strTableName holds the name of the table in the current database you want
to
>ZAP!!

>(And you abandoned Fox? Say it ain't so!)

>For #2 - yeah, that's about it. What I'm suggesting is a FoxPro solution,
may
>not work in Access, but it might lead to something. Can you get the data
into an
>array which matches the structure of the table?

>If so, for each record you import UPDATE TableName from Array, or, do an
INSERT
>INTO.

>If not, it may be faster to loop through the array ...

>For each record I want to import
>   Copy the data to an array
>   For nFieldIndex = 1 to arraylength
>          rs.fields( nFieldIndex) = array( nFieldIndex)
>  Next
>Next

>I gotta say it -- have you looked at Visual FoxPro lately? It's a fabulous
>development environment, and still blazing fast.

>Regards - Miles Thompson
>CQA Consulting Group, Enfield, NS Canada


>> Hi,

>> Here's a couple of easy ones.  I'm just hoping there's a better way.

>> 1.  Remember the old .DBF files...Remember the Zap command.  It blew out
all
>> the data in the table without destroying its structure.  Is there an
>> equivelant function in VB6 with ADO or DAO.  What I've been doing is the
>> old:
>>     rs.delete
>>     rs.movenext
>> Wend

>> This can be slow at times and seems like it can't be the only way.

>> 2. I populate a recordset from something other than a table.  However I
need
>> to put this records in this recordset into a table.  Once again there has
to
>> be a better way than for each record doing the:
>>     rs.fields!field1 = bla, bla, bla

>> Can't I just say parse the record into this record, etc.

>> Thanks,

>> Jason



Sun, 02 Jun 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. GPF in fairly simple programs ...

2. Trouble retrieving a fairly large number of records from a database

3. Please Help, I'm fairly new to VB

4. Fairly Easy String Manipulation Question

5. FAIRLY URGENT HELP NEEDED...Adding hexadecimal numbers

6. 2 fairly basic VB 4.0 Questions...

7. fairly new to this - question regarding .enabled

8. TreeView Control Fairly Easy Question

9. I need help with a datediff problem ( a fairly new user who needs help)

10. Creating Crystal Reports to be used in other sites (Fairly Urgent)

11. Q: Using a C DLL - fairly easy Q

12. A97 Wizard Qs

 

 
Powered by phpBB® Forum Software