List of Data Types
List of Data Types
List of Data Types
List of Data Types
List of Data Types
List of Data Types List of Data Types List of Data Types List of Data Types List of Data Types List of Data Types List of Data Types List of Data Types
List of Data Types List of Data Types
List of Data Types
Go Back  Xtreme Visual Basic Talk > > > List of Data Types


Reply
 
Thread Tools Display Modes
  #1  
Old 03-20-2013, 08:28 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default List of Data Types


Current, i'm working on an app that creates a
database, mostly using OLEDB when i can.

I got my app creating a database, creating tables
and fields but i'm stuck on the field data types.

If i use the built in enum data types, i get errors
saying that my syntax is wrong. An example:

Code:
"ALTER TABLE Customers ADD COLUMN " & FieldName & " " & ADOX.DataTypeEnum.adChar
In that case, i'm using the built in data type enum. I know
it an ADOX enum but i have used the OLEDB ones to and
both give me the same errors.

If i do it this way:

Code:
"ALTER TABLE Customers ADD COLUMN CustID Integer"
i get no errors and a new field is created.

So i guess the sql string needs me to write in the data type
in string form and not as a number like the built in ones,
give you.

I guess my question is, where can i find a list of all the
string data types like - integer, char(0), varchar() and so on.

I only know a few of them but i need to know more of them
so that i can set my code up right.

Thank you...
Reply With Quote
  #2  
Old 03-21-2013, 10:44 AM
CharlieMay's Avatar
CharlieMay CharlieMay is offline
Regular
 
Join Date: Sep 2009
Location: Indiana
Posts: 89
Default

There's a bunch here
__________________
I thought I knew what I was doing...
...And then I turned on Option Strict
Reply With Quote
  #3  
Old 03-21-2013, 01:28 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

Thanks for your reply

I had already found those, earlier today.

Four of them don't work in my app though.

Integer, Long, AutoNumber, Hyperlink

Here are the ones that do work.

Byte - Currency - DateTime - Double
Memo - Number - OleObject - Single
Text - YesNo


I'm using the Microsoft.Jet.OLEDB.4.0 database
so that is probably why the other data types
don't work.

Any way, thanks for that link.

**Edit**

I forgot to mention that i use "Counter" in
place of AutoNumber and PRIMARY KEY does
work to.
Reply With Quote
  #4  
Old 03-21-2013, 01:53 PM
Gruff's Avatar
GruffList of Data Types Gruff is offline
Bald Mountain Survivor

Retired Moderator
* Expert *
 
Join Date: Aug 2003
Location: Oregon, USA - deceased
Posts: 6,440
Default

Another option is to create an mdb in Access that contains autonumber an a few other fields types. Save it an use it as a template.
Basically include it in your setup program and programmically make a copy of it when you need to start a new mdb file.
Add other fields to it if you need to and your golden.
__________________
Burn the land and boil the sea
You can't take the sky from me


~T
Reply With Quote
  #5  
Old 03-21-2013, 02:43 PM
CharlieMay's Avatar
CharlieMay CharlieMay is offline
Regular
 
Join Date: Sep 2009
Location: Indiana
Posts: 89
Default

I think it AutoIncrement
Code:
CREATE Table AutonumberExample (MyID AUTOINCREMENT(1, 1), FirstName Text)
This should create an AutoNumber field called MyID and a FirstName Text Field. The (1,1) should be the starting number and the increment amount. It's been a while, if that doesn't work, let me know and I'll look into it.

I think any numeric type is just Number in access
__________________
I thought I knew what I was doing...
...And then I turned on Option Strict
Reply With Quote
  #6  
Old 03-21-2013, 11:21 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

AUTOINCREMENT(1, 1) works as far as being
adding a new field but it doesn't increment.

I'm using a datagridview to display the fields
and add records and i would assume that as
soon as i put the database data into a datagridview
that the first record, should already have a 1 in it.

i added a couple of records and it still doesn't
increment.

I'll check into it to.
Reply With Quote
  #7  
Old 03-22-2013, 02:07 PM
CharlieMay's Avatar
CharlieMay CharlieMay is offline
Regular
 
Join Date: Sep 2009
Location: Indiana
Posts: 89
Default

Works fine here. New records automatically incremented the id field (from code) and when I opened the database in Access and added a new row, the id automatically generated the next number.
__________________
I thought I knew what I was doing...
...And then I turned on Option Strict
Reply With Quote
  #8  
Old 03-22-2013, 09:49 PM
VB_Alien VB_Alien is offline
Senior Contributor
 
Join Date: Apr 2004
Posts: 854
Default

OK. I see what's going on. I don't know if this
is normal of a datagridview but when i fill out
the records, i leave the auto number field blank,
and just fill out the other fields.

Then i shut down the records display part of my
app and then open it back up and all the auto
number fields are filled in correctly.

If this isn't normal then i must need to update
the database and have it display everything, almost
in real time.

I thought i was but i'll check the code again.

This really isn't a problem but i noticed something
odd while filling in the fields.

With the database that i'm currently using, i have
an ID auto number field with a primary key set and
if i try to put in "First" as in First Name, in the next
field, i get a syntax error. To fix this, i have to use
a field name of First_Name and then it works. I've
never ran across that problem before.

I had a msgbox box pop up to show me the sql string
that i'm using to add a new TEXT field and it all looks
good, so i'm wondering if it is a problem with the driver
or something.

It's no biggy though. Just thought i'd point out that
problem.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
List of Data Types
List of Data Types
List of Data Types List of Data Types
List of Data Types
List of Data Types
List of Data Types List of Data Types List of Data Types List of Data Types List of Data Types List of Data Types List of Data Types
List of Data Types
List of Data Types
 
List of Data Types
List of Data Types
 
-->