|
-
Sep 29th, 2010, 06:14 AM
#1
Thread Starter
PowerPoster
ADD new fields from a loop
I just have a table1 into c:\mydir\mymbd.mdb
I just have 3 fields (field1, field2..)
I need, from the loop in code, to add new fields based the var TEST
Code:
RIGA = 0
While Not GAF_RS.EOF
TEST = GAF_RS(0)
RIGA = RIGA + 1
GAF_RS.MoveNext
Wend
note:
all fields are TEXT format and max character from var TEST is max 2
please with vb6 code, tks.
possible?
Last edited by luca90; Sep 29th, 2010 at 06:23 AM.
-
Sep 29th, 2010, 06:34 AM
#2
Re: ADD new fields from a loop
Modify to fit your needs
Code:
Dim sSQL As String
RIGA = 0
While Not GAF_RS.EOF
TEST = GAF_RS(0)
sSQL = "ALTER TABLE table1 ADD " & Test & " Text(2) "
YourConnectionObject.Execute sSQL
RIGA = RIGA + 1
GAF_RS.MoveNext
Wend
-
Sep 29th, 2010, 06:56 AM
#3
Thread Starter
PowerPoster
Re: ADD new fields from a loop
 Originally Posted by hack
modify to fit your needs
Code:
dim ssql as string
riga = 0
while not gaf_rs.eof
test = gaf_rs(0)
ssql = "alter table table1 add " & test & " text(2) "
yourconnectionobject.execute ssql
riga = riga + 1
gaf_rs.movenext
wend
excelletnt!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|