I am trying to create an access database within Net 2003 using the ADOX
library which works fine except when I try to add the AutoIncrement property
to the ContactId column.
I am experiencing a Property 'item' is ReadOnly error within the below line
.Columns("Conta ctId").Properti es("AutoIncreme nt") = True
Am I missing a reference or what am I doing wrong?????
Following is the sample code I am using (ex MSDN) as the starting point.
'Project references
'Microsoft ADO Ext. 2.8 for DDL and Security
'Microsoft ActiveX Data Accss Objects 2.8 Library
Imports ADOX
Imports ADOX.DataTypeEn um
Sub Main()
Dim cnn As New ADODB.Connectio n
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
cnn.Open "Provider='Micr osoft.Jet.OLEDB .4.0';" & _
"Data Source='Northwi nd.mdb';"
cat.ActiveConne ction = cnn
With tbl
.Name = "MyContacts "
.ParentCatalog = cat
' Create fields and append them to the new Table object.
.Columns.Append "ContactId" , adInteger
' Make the ContactId column and auto incrementing column
.Columns("Conta ctId").Properti es("AutoIncreme nt") = True
.Columns.Append "CustomerID ", adVarWChar
.Columns.Append "FirstName" , adVarWChar
.Columns.Append "LastName", adVarWChar
.Columns.Append "Phone", adVarWChar, 20
.Columns.Append "Notes", adLongVarWChar
End With
cat.Tables.Appe nd tbl
'Clean up
cnn.Close
Set cat = Nothing
Set tbl = Nothing
Set cnn = Nothing
End Sub 6 9178
Try changing it to this:
..Columns("Cont actId").Propert ies("AutoIncrem ent").Value = True
I had the same error until I did it this way.
james
"Michael" <mc********@hou ston.rr.com> wrote in message news:Pr******** *********@fe2.t exas.rr.com... I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncremen t property to the ContactId column.
I am experiencing a Property 'item' is ReadOnly error within the below line
.Columns("Conta ctId").Properti es("AutoIncreme nt") = True
Am I missing a reference or what am I doing wrong?????
Following is the sample code I am using (ex MSDN) as the starting point.
'Project references 'Microsoft ADO Ext. 2.8 for DDL and Security 'Microsoft ActiveX Data Accss Objects 2.8 Library
Imports ADOX Imports ADOX.DataTypeEn um
Sub Main()
Dim cnn As New ADODB.Connectio n Dim cat As New ADOX.Catalog Dim tbl As New ADOX.Table
cnn.Open "Provider='Micr osoft.Jet.OLEDB .4.0';" & _ "Data Source='Northwi nd.mdb';" cat.ActiveConne ction = cnn
With tbl .Name = "MyContacts " .ParentCatalog = cat ' Create fields and append them to the new Table object. .Columns.Append "ContactId" , adInteger ' Make the ContactId column and auto incrementing column .Columns("Conta ctId").Properti es("AutoIncreme nt") = True .Columns.Append "CustomerID ", adVarWChar .Columns.Append "FirstName" , adVarWChar .Columns.Append "LastName", adVarWChar .Columns.Append "Phone", adVarWChar, 20 .Columns.Append "Notes", adLongVarWChar End With cat.Tables.Appe nd tbl 'Clean up cnn.Close Set cat = Nothing Set tbl = Nothing Set cnn = Nothing End Sub
Try changing it to this:
..Columns("Cont actId").Propert ies("AutoIncrem ent").Value = True
I had the same error until I did it this way.
james
"Michael" <mc********@hou ston.rr.com> wrote in message news:Pr******** *********@fe2.t exas.rr.com... I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncremen t property to the ContactId column.
I am experiencing a Property 'item' is ReadOnly error within the below line
.Columns("Conta ctId").Properti es("AutoIncreme nt") = True
Am I missing a reference or what am I doing wrong?????
Following is the sample code I am using (ex MSDN) as the starting point.
'Project references 'Microsoft ADO Ext. 2.8 for DDL and Security 'Microsoft ActiveX Data Accss Objects 2.8 Library
Imports ADOX Imports ADOX.DataTypeEn um
Sub Main()
Dim cnn As New ADODB.Connectio n Dim cat As New ADOX.Catalog Dim tbl As New ADOX.Table
cnn.Open "Provider='Micr osoft.Jet.OLEDB .4.0';" & _ "Data Source='Northwi nd.mdb';" cat.ActiveConne ction = cnn
With tbl .Name = "MyContacts " .ParentCatalog = cat ' Create fields and append them to the new Table object. .Columns.Append "ContactId" , adInteger ' Make the ContactId column and auto incrementing column .Columns("Conta ctId").Properti es("AutoIncreme nt") = True .Columns.Append "CustomerID ", adVarWChar .Columns.Append "FirstName" , adVarWChar .Columns.Append "LastName", adVarWChar .Columns.Append "Phone", adVarWChar, 20 .Columns.Append "Notes", adLongVarWChar End With cat.Tables.Appe nd tbl 'Clean up cnn.Close Set cat = Nothing Set tbl = Nothing Set cnn = Nothing End Sub
James
The fix worked - thanks
Mike
"james" <jjames700ReMoV eMe at earthlink dot net> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. Try changing it to this: .Columns("Conta ctId").Properti es("AutoIncreme nt").Value = True
I had the same error until I did it this way.
james
"Michael" <mc********@hou ston.rr.com> wrote in message news:Pr******** *********@fe2.t exas.rr.com...I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncrement property to the ContactId column.
I am experiencing a Property 'item' is ReadOnly error within the below line
.Columns("Conta ctId").Properti es("AutoIncreme nt") = True
Am I missing a reference or what am I doing wrong?????
Following is the sample code I am using (ex MSDN) as the starting point.
'Project references 'Microsoft ADO Ext. 2.8 for DDL and Security 'Microsoft ActiveX Data Accss Objects 2.8 Library
Imports ADOX Imports ADOX.DataTypeEn um
Sub Main()
Dim cnn As New ADODB.Connectio n Dim cat As New ADOX.Catalog Dim tbl As New ADOX.Table
cnn.Open "Provider='Micr osoft.Jet.OLEDB .4.0';" & _ "Data Source='Northwi nd.mdb';" cat.ActiveConne ction = cnn
With tbl .Name = "MyContacts " .ParentCatalog = cat ' Create fields and append them to the new Table object. .Columns.Append "ContactId" , adInteger ' Make the ContactId column and auto incrementing column .Columns("Conta ctId").Properti es("AutoIncreme nt") = True .Columns.Append "CustomerID ", adVarWChar .Columns.Append "FirstName" , adVarWChar .Columns.Append "LastName", adVarWChar .Columns.Append "Phone", adVarWChar, 20 .Columns.Append "Notes", adLongVarWChar End With cat.Tables.Appe nd tbl 'Clean up cnn.Close Set cat = Nothing Set tbl = Nothing Set cnn = Nothing End Sub
James
The fix worked - thanks
Mike
"james" <jjames700ReMoV eMe at earthlink dot net> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. Try changing it to this: .Columns("Conta ctId").Properti es("AutoIncreme nt").Value = True
I had the same error until I did it this way.
james
"Michael" <mc********@hou ston.rr.com> wrote in message news:Pr******** *********@fe2.t exas.rr.com...I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncrement property to the ContactId column.
I am experiencing a Property 'item' is ReadOnly error within the below line
.Columns("Conta ctId").Properti es("AutoIncreme nt") = True
Am I missing a reference or what am I doing wrong?????
Following is the sample code I am using (ex MSDN) as the starting point.
'Project references 'Microsoft ADO Ext. 2.8 for DDL and Security 'Microsoft ActiveX Data Accss Objects 2.8 Library
Imports ADOX Imports ADOX.DataTypeEn um
Sub Main()
Dim cnn As New ADODB.Connectio n Dim cat As New ADOX.Catalog Dim tbl As New ADOX.Table
cnn.Open "Provider='Micr osoft.Jet.OLEDB .4.0';" & _ "Data Source='Northwi nd.mdb';" cat.ActiveConne ction = cnn
With tbl .Name = "MyContacts " .ParentCatalog = cat ' Create fields and append them to the new Table object. .Columns.Append "ContactId" , adInteger ' Make the ContactId column and auto incrementing column .Columns("Conta ctId").Properti es("AutoIncreme nt") = True .Columns.Append "CustomerID ", adVarWChar .Columns.Append "FirstName" , adVarWChar .Columns.Append "LastName", adVarWChar .Columns.Append "Phone", adVarWChar, 20 .Columns.Append "Notes", adLongVarWChar End With cat.Tables.Appe nd tbl 'Clean up cnn.Close Set cat = Nothing Set tbl = Nothing Set cnn = Nothing End Sub
Glad it worked for you.
james
"Michael" <mc********@hou ston.rr.com> wrote in message news:ue******** **********@fe2. texas.rr.com... James
The fix worked - thanks
Mike
"james" <jjames700ReMoV eMe at earthlink dot net> wrote in message news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. Try changing it to this: .Columns("Conta ctId").Properti es("AutoIncreme nt").Value = True
I had the same error until I did it this way.
james
Glad it worked for you.
james
"Michael" <mc********@hou ston.rr.com> wrote in message news:ue******** **********@fe2. texas.rr.com... James
The fix worked - thanks
Mike
"james" <jjames700ReMoV eMe at earthlink dot net> wrote in message news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. Try changing it to this: .Columns("Conta ctId").Properti es("AutoIncreme nt").Value = True
I had the same error until I did it this way.
james This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tamblyne |
last post by:
This problem has got to have a simple solution and I can't be the first
person who has ever handled it. Perhaps Google is no help because I'm
not using the right terms? (I did find one post on-point, but no one
responded to it.)
I have a two column layout with a header and a footer. If the "content"
is longer than the "navigation", there is no problem. However, if the
content is shorter than the navigation, the navigation menus...
|
by: Ivaylo |
last post by:
I use OleDbAdapter to fill my dataset from Access database and tables with autoincrement id columns.Also i created xsd schema for my dataset
The problem is that the dataset automatically add neu unique ID which is not correspond to realy added record ID in the database
For exp. in database i have
ID Name Titl
10 john some tex
12 peter .......
ds.Table1Row newrow=ds.Table1.NewTable1Row(
|
by: Michael |
last post by:
I am trying to create an access database within Net 2003 using the ADOX
library which works fine except when I try to add the AutoIncrement property
to the ContactId column.
I am experiencing a Property 'item' is ReadOnly error within the below line
.Columns("ContactId").Properties("AutoIncrement") = True
Am I missing a reference or what am I doing wrong?????
|
by: Dan Manes |
last post by:
Wondering what other people do about this issue...
You're writing a web app in asp.net that requires user input. Data will
be stored in SQL Server Express database. You want to make sure data
does not exceed maximum length for database column.
For example, "User Name" column in database is set to varchar(30), so
you would like to also set your textbox to a MaxLength of 30. To guard
against hackers, etc., you also want to set up a...
|
by: Bren |
last post by:
Hi All
VS2005 Gridview control with vb
I am populating a gridview of company staff.
One of the columns is a hyperlink to a SMS texting facility I have so
secrataries can text the managers etc.
i.e Secratary loads the page on the intranet, finds the manager they want to
contact, clicks on the "SMS" hyperlink and is taken to the SMS page to fill
out the message and send it to the manager.
| |
by: adnanahmed714 |
last post by:
hi all
i want to calculate the Standered deviation of last 20 values in the database column,how can i do it using DTDEV function of SQL.
PLZZZZZZZZZZZZZZZZ
Reply me
Thanks in advance to all.
|
by: adnanahmed714 |
last post by:
Hi All
i Want to calculate STDEV of last 20 values in the database Column,using VB
Want help on the syntax of the statment
Thanks in advance
|
by: momo |
last post by:
Hi everybody,
I have to implement a routing and wavelength assignment problem (RWA)
for a given optical network. I ve implemented the network graph in C
using linked list. the shortest-path routing problem is done.
does anyone have any idea how to implement in C the assignement
problem? or have the code? the algorithm should assign wavelengths to
incoming calls until capacity is reached over a given path, hence the
call is rejected.
...
|
by: Chris |
last post by:
I have a database column that stores a comma delimited list of foreign
keys. Would someone show me how to do a join using the values from a
list stored within a record?
For example, a record in tbl_cds.genre_id might have a value of "2,
5, 6" corresponding to genre_ids 2 , 5 and 6. I want to join
tbl_cds.genre_id to tbl_genre.genre_id using the values in that data
field.
It seems I need a loop like this:
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |