473,396 Members | 1,816 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,396 software developers and data experts.

Create Access table with vb/net then insert

I have a procedure that uses ADOX to create a database with a table.
That works fine. I then need to populate that table with a record but
the code is not working. I believe that the database is still locked.

Dim lcat as New ADOX.Catalog
Dim ltbl As New ADOX.Table

lcat.Create(connection)

' Code to create table.

ltbl = Nothing
lcat = Nothing

In the same procedure, I create a connection to execute a INSERT
command, but an error is generated on the lcnn.open()

Dim lcnn As Data.OleDb.OleDbConnection

lcnn = New Data.OleDb.OleDbConnection(lstrConnection)
lcnn.Open()

Thanks!

Dec 5 '05 #1
3 7393
adebiasio,

Have a look at this sample, it uses only the ADOX to create the database and
than for the table and columns ADONET.

In the way that the last is done you can also do it with your insert
statements in the executenonquery.

http://www.vb-tips.com/default.aspx?...1-d6dda3c888c8

I hope this helps,

Cor
Dec 6 '05 #2
On 5 Dec 2005 13:52:35 -0800, ad*******@sympatico.ca wrote:

¤ I have a procedure that uses ADOX to create a database with a table.
¤ That works fine. I then need to populate that table with a record but
¤ the code is not working. I believe that the database is still locked.
¤
¤ Dim lcat as New ADOX.Catalog
¤ Dim ltbl As New ADOX.Table
¤
¤ lcat.Create(connection)
¤
¤ ' Code to create table.
¤
¤ ltbl = Nothing
¤ lcat = Nothing
¤
¤ In the same procedure, I create a connection to execute a INSERT
¤ command, but an error is generated on the lcnn.open()
¤
¤ Dim lcnn As Data.OleDb.OleDbConnection
¤
¤ lcnn = New Data.OleDb.OleDbConnection(lstrConnection)
¤ lcnn.Open()
You might want to post your code and identify the error and where it is occurring.
Paul
~~~~
Microsoft MVP (Visual Basic)
Dec 6 '05 #3
Thanks for your help. Sometimes the simplist error is ignored. I had
a syntax error in the INSERT.

Thanks!

Dec 7 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Barbara Lindsey | last post by:
I am a postgres newbie. I am trying to create a trigger that will put a copy of a record into a backup table before update or delete. As I understand it, in order to do this I must have a...
2
by: Alicia | last post by:
Does anyone know why I am getting a "Syntax error in Create Table statement". I am using Microsoft Access SQL View to enter it. Any other problems I may run into? CREATE TABLE weeks (...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
4
by: John T. Howard | last post by:
Can you issue commands from VB.Net to create and delete databases? I would like to create, delete, and copy MSAccess tables and/or databases from code. Can this be done? Can you show, or point...
4
by: Wayne Wengert | last post by:
I am trying to create a VB.NET Windows application to move some data from a local Access DB table to a table in a SQL Server. The approach I am trying is to open an OLEDB connection to the local...
0
by: neoteny2 | last post by:
I need MS Access to automatically create reports/subreports based on specific criteria. I am building a database in Access 2003 with different locations/sites. I have the "sites" table created...
4
by: Jan | last post by:
Have an SQL create/import script. Running this on SQL would make it create a table with some values. Can Access2003 somehow use such and SQL script? I went into SQL query view to try it out, but...
6
by: Peter Nurse | last post by:
For reasons that are not relevant (though I explain them below *), I want, for all my users whatever privelige level, an SP which creates and inserts into a temporary table and then another SP...
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.