VB Net and ADOX

T

T Clancey

Hi.

I have an application that needs to update a database, as I'm using vb net
and an access database I have to do this using ADOX. I don't think there is
another way.

I have found all sorts of examples which are basically the same, but none of
them work!

I can create my tables and fields without any problems at all, but I want to
create an AutoNumber field. All the examples state something like,
fld.properties("Autoincrement")=true. Vb net tells me that the 'Item' is
read only, I can't find anything else that helps.

Anyone come across this? Or have an answer?

Cheers,
Tull.
 
P

Patrice

Try :

fld.Properties("AutoIncrement").Value=True

as fld.Properties("AutoIncrement") returns an object, not a boolean and you
don"t have any more non indexed default properties in VB.NET....

My personal preference would be likely to use SQL statements whenever
possible...
 
T

T Clancey

Would be nice, but as far as I know the Jet engine doesn't cater for table
or field updates to Access.

I'll give what you suggest a try.

Cheers,
Tull.
 
S

sweet_dreams

T Clancey napisal(a):
Hi.

I have an application that needs to update a database, as I'm using vb net
and an access database I have to do this using ADOX. I don't think there is
another way.

I have found all sorts of examples which are basically the same, but none of
them work!

I can create my tables and fields without any problems at all, but I want to
create an AutoNumber field. All the examples state something like,
fld.properties("Autoincrement")=true. Vb net tells me that the 'Item' is
read only, I can't find anything else that helps.

Anyone come across this? Or have an answer?

Cheers,
Tull.


Hi Tull,

I suggest you use ADO.NET which is data access technology recommended
to use with .NET languages. You can access databases like SQL Server,
MS Access, Oracle and many many more. You can basics of ADO.NET here:
http://tinyurl.com/q2vz6
http://tinyurl.com/nlnks
http://www.startvbdotnet.com/ado/default.aspx
http://tinyurl.com/olhsp
http://tinyurl.com/rfzym
http://msdn.microsoft.com/data/ref/adonet/default.aspx

regards,
sweet_dreams
 
P

Paul Clement

¤ Hi.
¤
¤ I have an application that needs to update a database, as I'm using vb net
¤ and an access database I have to do this using ADOX. I don't think there is
¤ another way.
¤
¤ I have found all sorts of examples which are basically the same, but none of
¤ them work!
¤
¤ I can create my tables and fields without any problems at all, but I want to
¤ create an AutoNumber field. All the examples state something like,
¤ fld.properties("Autoincrement")=true. Vb net tells me that the 'Item' is
¤ read only, I can't find anything else that helps.
¤
¤ Anyone come across this? Or have an answer?

ALTER TABLE TABLE_1 ADD COLUMN [ID] COUNTER


Paul
~~~~
Microsoft MVP (Visual Basic)
 
G

GhostInAK

Hello Paul,

I'm not positive, but I believe last time I checked (admittedly a long time
ago) Jet didn't support the ALTER keyword.

To the OP: If this is an app you are giving to other people, not just something
you use yourself, then I would strongly suggest using MSDE, Sql 2005 Express
(or Pro), or the new SQL Everywhere (it's true.. SQL is even commin out my
ears).. You'll be kickin yourself as time goes on if you stick with Access.

-Boo
 
G

Guest

Ghost,

It now supports ALTER. See my previous reply, especially the second article
in the 3-article series.

Kerry Moorman


GhostInAK said:
Hello Paul,

I'm not positive, but I believe last time I checked (admittedly a long time
ago) Jet didn't support the ALTER keyword.

To the OP: If this is an app you are giving to other people, not just something
you use yourself, then I would strongly suggest using MSDE, Sql 2005 Express
(or Pro), or the new SQL Everywhere (it's true.. SQL is even commin out my
ears).. You'll be kickin yourself as time goes on if you stick with Access.

-Boo
On Fri, 18 Aug 2006 13:04:55 +0100, "T Clancey"

¤ Hi.
¤
¤ I have an application that needs to update a database, as I'm using
vb net
¤ and an access database I have to do this using ADOX. I don't think
there is
¤ another way.
¤
¤ I have found all sorts of examples which are basically the same, but
none of
¤ them work!
¤
¤ I can create my tables and fields without any problems at all, but I
want to
¤ create an AutoNumber field. All the examples state something like,
¤ fld.properties("Autoincrement")=true. Vb net tells me that the
'Item' is
¤ read only, I can't find anything else that helps.
¤
¤ Anyone come across this? Or have an answer?
ALTER TABLE TABLE_1 ADD COLUMN [ID] COUNTER

Paul
~~~~
Microsoft MVP (Visual Basic)
 
P

Paul Clement

¤ Hello Paul,
¤
¤ I'm not positive, but I believe last time I checked (admittedly a long time
¤ ago) Jet didn't support the ALTER keyword.
¤

Yeah, I tested it from the Access QBE before I posted. It works just fine.


Paul
~~~~
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top