[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Integer becomes double: create table (dbase)

Karl Tarbet

11/4/2002 8:34:00 PM

Hello:
I'm using the CREATE TABLE sql command with odbc dbase
driver (*.dbf).

How do I create a integer column?
My test below creates a double, in the first column,
instead of integer.
Thanks for any help
--------------
Karl

string sql = "CREATE TABLE test"+
" (myInt int, myFloat float, myString Char(32))";
// I even tried short -- but still get double.

string strAccessConn = @"Driver={Microsoft dBase Driver
(*.dbf)};DBQ=C:\";

OdbcConnection myConnection = new OdbcConnection
(strAccessConn);
myConnection.Open();
OdbcCommand myCommand = new OdbcCommand();
myCommand.Connection = myConnection;
try
{
myCommand.CommandText = sql;
myCommand.ExecuteNonQuery();
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
throw e;
}
finally
{
myConnection.Close();
}


1 Answer

(Scot Rose)

11/5/2002 4:11:00 PM

0

I tried to trip my way around this article but I could not... As strange as it seems this is the expected behavior using the Microsoft drivers.. Per

Q104918 Differences Among the Installable ISAMs in VB 3.0
http://support.mic.../default.aspx?scid=kb;EN-...

the critical portion is where it talks about how the datatypes will be mapped from VB

DB_BOOLEAN DB_BOOLEAN
DB_BYTE DB_DOUBLE
DB_INTEGER DB_DOUBLE
DB_LONG DB_DOUBLE
DB_CURRENCY DB_DOUBLE
DB_SINGLE DB_DOUBLE
DB_DOUBLE DB_DOUBLE
DB_DATE DB_DATE
DB_TEXT DB_TEXT
DB_LONGBINARY DB_MEMO
DB_MEMO DB_MEMO

From what it shows here ALL number types are mapped to Double when creating a table..

Want to know more? Check out the MSDN Library at http://msdn.mic... or the Microsoft Knowledge Base at http://support.mic...

Scot Rose, MCSD
Microsoft Visual Basic Developer Support
Email : scotr@online.microsoft.com <Remove word online. from address>

This posting is provided “AS IS”, with no warranties, and confers no rights.