From: Clyde E. <ct...@gm...> - 2017-03-22 21:23:24
|
To create a table: ----------------------------- int iTablesCount = liststTableNames.Count(); try { string stOpenConn = new FbConnectionStringBuilder { Database = stPathFilename, UserID = stUserID, Password = stPassword, ServerType = FbServerType.Embedded, ClientLibrary = stCLIENT_LIBRARY }.ToString(); FbConnection fbConn = new FbConnection(stOpenConn); fbConn.Open(); FbTransaction fbTransaction = fbConn.BeginTransaction(); for (int ii = 0; ii < iTablesCount; ii++) { string stSql = "CREATE TABLE " + liststTableNames[ii] + "( " + liststFieldDefinitions[ii] + ")"; FbCommand fbCmd = new FbCommand(stSql, fbConn, fbTransaction); fbCmd.ExecuteNonQuery(); } fbTransaction.Commit(); ----------------------------- where stSql = "CREATE TABLE TableOrg ( fstPriority VARCHAR(10), fstInfo VARCHAR(100), fiKeyID INTEGER PRIMARY KEY )". 1) Is it correct to have multiple fbCmd.ExecuteNonQuery() commands ... followed by one fbTransaction.Commit()? 2) I want to be able to handle German vowels, such as umlauts, for fstInfo. I don't think VARCHAR is the correct choice as it is non-unicode. 3) I also want variable lengths, without a max, for fstInfo. What do I use in place of the "100"? |