I am new to MS Access 2007 and I am creating an application using Visual Studio 2010 C#. I am wondering what datatype should I use in each parameter I am creating.
For example:
command.Parameters.Add(new OleDbParameter("?company_name", OleDbType.VarChar));
This is a data type for characters(correct me if I am wrong).
My question is, what is the data type for numbers(example: zip code and telephone number(221-0019)) to use is correct to use the numeric data type?
P.S.: I already have my table in MS Access
Use whatever datatype fits your data.
E.g. if you require a column to store whole number between 0 to 100 use a field with a
DataTypeofNumberwith aFieldSizeofByte. For a whole number between 0 and 10,000 useInteger. For a fractional number between -1,000,000,000 and 1,000,000,000 useSingle. See the MSAcess help forDataTypeandFieldSizeto see what is appropriate for your data.Then, when manipulating the database from C#, use the equivalent
OleDbType. See the help forOldDbTypeto decide which one is equivalent to the datatype in the MSAccess column.E.g. (as per above examples)
OleDbType.UnsignedTinyInt,OleDbType.SmallInt,OleDbType.Single