473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help with VB database table creation

1
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,Test_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_Cycle" 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 1818
debasisdas
8,127 Expert 4TB
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 Expert 1GB
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
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 ...
4
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...
6
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...
6
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...
4
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...
10
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...
6
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 ...
4
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...
0
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.