Wrox Programmer Forums
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2004, 05:18 AM
Aal Aal is offline
Authorized User
 
Join Date: Oct 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to do this

Hi
I have 5 textbox in array, five fields in my tables. To add the records in that tables, I want to make an insert into statement in a loops ( For . . . Next ), and i want to make it with SQL Statements
"INSERT INTO T_Member VALUES('" & txt(x-1).text & "')"
But there's some error msg i had with a different msg, like Item not found and else in my table. And how to convert in a loops if i have one field with Number Data Type or OLE.
My thank's and appreciation for all suggestions . . .



 
Old November 1st, 2004, 09:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there..
just use one insert statement, do something like this
Code:
ssql = "insert into t_member values ("
for i = 0 to textbox.count
[tab]ssql = ssql & textbox(i).text & ","
next i
ssql = mid(1,ssql(len(ssql)-1) & ")"
HTH

Gonzalo
 
Old November 11th, 2004, 02:38 AM
Aal Aal is offline
Authorized User
 
Join Date: Oct 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank u for your replies . . . that's works for me
but how if i want to check, a different data type of a field when i do a looping in a looping . . .thank's again for your replies. ( let's assume that i used Access database )










Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.