0

SQL Server Compact エディションでは、プログラムでデータベースを作成するときに整数をどのように定義しますか? 試してみましたが、intどれも機能しません。データ型が無効であるという例外がすべてスローされますか?Int32Bigint

string createTable6 = "CREATE TABLE Gates (Gate1In Bigint(5), Gate1Out Bigint(5), Gate2In Bigint(5), Gate2Out Bigint(5), Gate3In Bigint(5), Gate3Out Bigint(5), Gate4In Bigint(5), Gate4Out Bigint(5), Gate5In Bigint(5), Gate5Out Bigint(5))";

SqlCeConnection connexion6 = new SqlCeConnection(connectionString);
SqlCeCommand table6 = new SqlCeCommand(createTable6, connexion6);

try
{
    connexion6.Open();
    table6.ExecuteNonQuery();
}
catch (Exception ex)
{
    MessageBox.Show(ex.ToString());
}

connexion6.Close();
4

2 に答える 2

1

bigint括弧なしで使用する

string createTable6 = "CREATE TABLE Gates (Gate1In bigint, Gate1Out bigint, " + 
       "Gate2In bigint, Gate2Out bigint, Gate3In bigint, Gate3Out bigint, " + 
       "Gate4In bigint, Gate4Out bigint, Gate5In bigint, Gate5Out bigint)";

ただし、でも動作するはずintです。そして、その整数スペース (8 バイト) が本当に必要ない場合は、int を使用できます。

于 2013-10-12T15:55:18.240 に答える
1

データ型宣言の後に括弧があるのは事実です:

これを試して:

string createTable6 = "CREATE TABLE Gates (Gate1In Bigint, Gate1Out Bigint, Gate2In Bigint, " + 
       "Gate2Out Bigint, Gate3In Bigint, Gate3Out Bigint, Gate4In Bigint, Gate4Out Bigint, " +
       "Gate5In Bigint, Gate5Out Bigint)";
于 2013-10-12T15:57:54.963 に答える