Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 about sql query in vb

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-09 : 10:24:28
shashi writes "i have 100 fields in a table
how to insert values in Access Table
in my table i have 100 fields
using vb frontend how to insert values into access table
how don't know continuation of sql query

plese give me dummy code using 100 fields (dummy fields)"

rrb
SQLTeam Poet Laureate

1479 Posts

Posted - 2002-05-09 : 22:12:05
How many fields in your table? 100 by any chance?

You'll need to build an "INSERT" SQL statement as a string
eg
SQL = "INSERT INTO MyTable ("
For i = 1 to 100
SQL = SQL & Values(i).FieldName & ","
Next i
SQL = Left(SQL, Len(SQL)-1) '-strip off last comma
SQL = SQL & ") SELECT ("
For i = 1 to 100
SQL = SQL & Values(i).Value & ","
Next i
SQL = Left(SQL, Len(SQL)-1) '-strip off last comma
SQL = SQL & ")"

rst.Open SQL , cnDB

etc etc etc

Sounds a bit like a homework question though....
etc etc etc

--
I hope that when I die someone will say of me "That guy sure owed me a lot of money"
Go to Top of Page
   

- Advertisement -