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?????
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.DataTypeEnum
Sub Main()
Dim cnn As New ADODB.Connection
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
cnn.Open "Provider='Microsoft.Jet.OLEDB.4.0';" & _
"Data Source='Northwind.mdb';"
cat.ActiveConnection = 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("ContactId").Properties("AutoIncrement") = 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.Append tbl
'Clean up
cnn.Close
Set cat = Nothing
Set tbl = Nothing
Set cnn = Nothing
End Sub 6 9141
Try changing it to this:
..Columns("ContactId").Properties("AutoIncrement") .Value = True
I had the same error until I did it this way.
james
"Michael" <mc********@houston.rr.com> wrote in message news:Pr*****************@fe2.texas.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("ContactId").Properties("AutoIncrement") = 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.DataTypeEnum
Sub Main()
Dim cnn As New ADODB.Connection Dim cat As New ADOX.Catalog Dim tbl As New ADOX.Table
cnn.Open "Provider='Microsoft.Jet.OLEDB.4.0';" & _ "Data Source='Northwind.mdb';" cat.ActiveConnection = 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("ContactId").Properties("AutoIncrement") = 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.Append tbl 'Clean up cnn.Close Set cat = Nothing Set tbl = Nothing Set cnn = Nothing End Sub
Try changing it to this:
..Columns("ContactId").Properties("AutoIncrement") .Value = True
I had the same error until I did it this way.
james
"Michael" <mc********@houston.rr.com> wrote in message news:Pr*****************@fe2.texas.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("ContactId").Properties("AutoIncrement") = 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.DataTypeEnum
Sub Main()
Dim cnn As New ADODB.Connection Dim cat As New ADOX.Catalog Dim tbl As New ADOX.Table
cnn.Open "Provider='Microsoft.Jet.OLEDB.4.0';" & _ "Data Source='Northwind.mdb';" cat.ActiveConnection = 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("ContactId").Properties("AutoIncrement") = 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.Append tbl 'Clean up cnn.Close Set cat = Nothing Set tbl = Nothing Set cnn = Nothing End Sub
James
The fix worked - thanks
Mike
"james" <jjames700ReMoVeMe at earthlink dot net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... Try changing it to this: .Columns("ContactId").Properties("AutoIncrement"). Value = True
I had the same error until I did it this way.
james
"Michael" <mc********@houston.rr.com> wrote in message news:Pr*****************@fe2.texas.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("ContactId").Properties("AutoIncrement") = 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.DataTypeEnum
Sub Main()
Dim cnn As New ADODB.Connection Dim cat As New ADOX.Catalog Dim tbl As New ADOX.Table
cnn.Open "Provider='Microsoft.Jet.OLEDB.4.0';" & _ "Data Source='Northwind.mdb';" cat.ActiveConnection = 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("ContactId").Properties("AutoIncrement") = 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.Append tbl 'Clean up cnn.Close Set cat = Nothing Set tbl = Nothing Set cnn = Nothing End Sub
James
The fix worked - thanks
Mike
"james" <jjames700ReMoVeMe at earthlink dot net> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... Try changing it to this: .Columns("ContactId").Properties("AutoIncrement"). Value = True
I had the same error until I did it this way.
james
"Michael" <mc********@houston.rr.com> wrote in message news:Pr*****************@fe2.texas.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("ContactId").Properties("AutoIncrement") = 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.DataTypeEnum
Sub Main()
Dim cnn As New ADODB.Connection Dim cat As New ADOX.Catalog Dim tbl As New ADOX.Table
cnn.Open "Provider='Microsoft.Jet.OLEDB.4.0';" & _ "Data Source='Northwind.mdb';" cat.ActiveConnection = 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("ContactId").Properties("AutoIncrement") = 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.Append tbl 'Clean up cnn.Close Set cat = Nothing Set tbl = Nothing Set cnn = Nothing End Sub
Glad it worked for you.
james
"Michael" <mc********@houston.rr.com> wrote in message news:ue******************@fe2.texas.rr.com... James
The fix worked - thanks
Mike
"james" <jjames700ReMoVeMe at earthlink dot net> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... Try changing it to this: .Columns("ContactId").Properties("AutoIncrement"). Value = True
I had the same error until I did it this way.
james
Glad it worked for you.
james
"Michael" <mc********@houston.rr.com> wrote in message news:ue******************@fe2.texas.rr.com... James
The fix worked - thanks
Mike
"james" <jjames700ReMoVeMe at earthlink dot net> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl... Try changing it to this: .Columns("ContactId").Properties("AutoIncrement"). 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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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 ...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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,...
| |