473,569 Members | 3,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with VB database table creation

1 New Member
Expand|Select|Wrap|Line Numbers
  1. Set tblNew_Cycle = db.CreateTableDef(New_Cycle_Name)
  2.  
  3.  
  4. 'Adding Fields to the Table
  5. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Test_Cycle", dbText)
  6. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Sno", dbInteger)
  7. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Group_Name", dbText)
  8. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Test_Case", dbText)
  9. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Result", dbText)
  10. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Tester", dbText)
  11. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Date_Tested", dbDate)
  12. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("CR", dbText)
  13. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("CL", dbText)
  14. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Star_Team_Ref", dbText)
  15. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Dummy_Notes", dbText)
  16. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Total_Steps", dbText)
  17. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Failed_Step", dbText)
  18. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Original_Tester", dbText)
  19. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Review_Comments", dbText)
  20. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Tester_Comments", dbText)
  21. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Action_Taken", dbText)
  22. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Bug_Status", dbText)
  23. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Duplicate", dbText)
  24. tblNew_Cycle.Fields.Append tblNew_Cycle.CreateField("Step_Needing_Clarification", dbText)
  25.  
I created a database table in the above manner. Here New_Cycle_Name is a variable which contains the actual name which the table shld be given.
This code is placed in a loop so every time a new table shld be created with a new name.

Now my problem is
1. How do i insert values into the table using SQL Insert Into command??
I tried it in the following way:


db.Execute ("Insert into tbl_New_Cycle (Test_Cycle,Sno ,Group_Name,Tes t_Case,Tester) values('" & New_Cycle_Name & "','" & no & "', """ & Group_Name & """, """ & Test_Case & """,'" & Tester & "')")


But while running the program i got an error saying that output table "tbl_New_Cy cle" not found, This is because the table that is created in the database has a different name ex TC99..

2.Similarly I am not able to query the table for any kind of results because of the table name being different.



Any help will be appreciated. I searched the net a ot for some solution but couldn`t get any.
Thanks
Oct 25 '07 #1
2 1823
debasisdas
8,127 Recognized Expert Expert
tbl_New_Cycle is not the table name that is a variable , so how can you hardcode that one.

try this
Expand|Select|Wrap|Line Numbers
  1. db.Execute ("Insert into" & tbl_New_Cycle & "(Test_Cycle,Sno,Group_Name,Test_Case,Tester) values ('" & New_Cycle_Name & "','" & no & "', """ & Group_Name & """, """ & Test_Case & """,'" & Tester & "')")
  2.  
Nov 4 '07 #2
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

One more correction over here : Field "SNo" is an Integer, so you should not wrap it in single Quotes..:

Check this :
Expand|Select|Wrap|Line Numbers
  1. db.Execute ("Insert into" & tbl_New_Cycle & "(Test_Cycle,Sno,Group_Name,Test_Case,Tester) values ('" & New_Cycle_Name & "'," & no & ", '" & Group_Name & '", '" & Test_Case & "','" & Tester & "')")
  2.  
Regards
Veena
Nov 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
9859
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ********************************** package Celcom.Client;
4
1575
by: MuZZy | last post by:
Hi, I just wonder if someone can help me with this: I need to create a sql script which will run when user installs/upgrades my app. User may already have the database and tables tructure setup on the server, or may not. The script needs to conditionally create database, conditionally create tables, and conditionally add columns to the...
6
2276
by: Bernd Koehler | last post by:
Hi: I am a EE prof currently teaching an IT course. One the assignments students recently completed was designing a small MS Access Database. I have two submissions that are remarkably similiar..<sigh> the structure (number of tables, field names, table names) is virtually identical. Some of the data in each table is different.
6
4971
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing for long running reports. When the processing is complete it uses crystal reports to load a template file, populate it, and then export it to a...
4
3244
by: JonathanParker | last post by:
Looking for some help urgently with some VB SQL Access stuff. You'll have to excuse the messiness of the code, I'm a newbie at all this. I'm running this code with a selection of check boxes to select extra fields for my table that is then exported to Excel. there are 3 fields that are always part of the SQL, when these are selected it works...
10
4269
by: shsandeep | last post by:
The ETL application loaded around 3000 rows in 14 seconds in a Development database while it took 2 hours to load in a UAT database. UAT db is partitioned. Dev db is not partitioned. the application looks for existing rows in the table...if they already exist then it updates otherwise inserts them. The table is pretty large, around 6.5...
6
1563
by: André | last post by:
Hi, I made a webform for a survey, with multiple-choice questions. The results of each question is put into a table e.g.: values frequency 1 6 2 3 3 32 4 26 5 12
4
2206
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I wanted to move my work and needed to place it on the server. Using VS 2005 , went to BUILD -Publish Web Site Checked the box for :: Alow this...
0
3159
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works fine. Now we decided to move from mainframe IMS-DB2 to Windows 2003 server-DB2 UDB for LUW 9.5.
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7930
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8138
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6290
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1229
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.