|
-
April 25th, 2004, 07:11 AM
#1
VB : evaluate string
Hi,
I construct a string in my application like mystring= "insert into DRTABLE(field1,field2) values (MSFLEXGRID1.textmatrix(i,1), MSFLEXGRID.TEXTMATRIX(i,2))"
Now i want to use this string in a for-loop :
For i = 0 To MSFlexGrid1.Rows - 1 Step 1
'in this statement the i should be replaced by the value of
'the loop counter i
'the replace function does not help, because the string is still
'not taken as a statement which can be executed
execute(mystring)
Next i
Anyone knows how i can do that ?
-
April 25th, 2004, 11:08 AM
#2
You want to insert everything the user had written to a flexgrid into the datebase
start the for loop
For
execute("INSERT INTO ...")
Next
or you could do that
For
strCommand = strCommand & vbcrlf & "INSERT INTO.... ;"
Next
Execute(strCommand)
hope that helped.
greetings UNI
-
April 25th, 2004, 01:00 PM
#3
Re: VB : evaluate string
Originally posted by jieves
I construct a string in my application like mystring= "insert into DRTABLE(field1,field2) values (MSFLEXGRID1.textmatrix(i,1), MSFLEXGRID.TEXTMATRIX(i,2))"
you need string concatination :
Code:
mystring="insert into DRTABLE(field1,field2) values(" & MSFLEXGRID1.textmatrix(i,1) & "," & MSFLEXGRID.TEXTMATRIX(i,2) & ")"
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
|