本文整理汇总了C#中DBType类的典型用法代码示例。如果您正苦于以下问题:C# DBType类的具体用法?C# DBType怎么用?C# DBType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DBType类属于命名空间,在下文中一共展示了DBType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TableBase
/// <summary>
/// Instantiate a Table by directly deserializing byte data from the given Deserializer.
/// </summary>
/// <param name="input">The Deserializer providing the data for the table.</param>
internal TableBase(Deserializer input)
{
// Total byte length of the table data (ignored).
int tableLength = input.ReadInt32();
// Total byte length of the Table metadata.
int tableMetadataLength = input.ReadInt32();
// Status code (custom user-set value).
this.Status = input.ReadSByte();
// Column Count.
this.ColumnCount = input.ReadInt16();
// Initialize column-driven data store.
ColumnType = new DBType[this.ColumnCount];
Column = new object[this.ColumnCount];
// Read column data types.
for (short c = 0; c < this.ColumnCount; c++)
ColumnType[c] = (DBType)input.ReadSByte();
// Read column names.
this.ColumnNameData = input.ReadRaw(tableMetadataLength - 3 - this.ColumnCount);
// Row count.
this.RowCount = input.ReadInt32();
}
示例2: WebConfigImpl
public WebConfigImpl(FileInfo fileInfo)
{
Debug.Assert(null != fileInfo);
if (!fileInfo.Exists) throw new InvalidDataException("fileInfo file does not exists.");
string xsd = "http://chernoivanov.org/SmsDeliveryTest";
XmlDocument xDoc = new XmlDocument();
xDoc.Load(fileInfo.FullName);
XmlNamespaceManager names = new XmlNamespaceManager(xDoc.NameTable);
names.AddNamespace("a", xsd);
XmlNode node = xDoc.SelectSingleNode("//a:DB", names);
this.dbType = (DBType)Enum.Parse(typeof(DBType), node.Attributes["type"].Value, true);
this.dbConnectionString = Utils.formatText(node.SelectSingleNode("a:ConnectionString/text()", names).Value).Replace("; ", ";");
XmlNodeList nodes = xDoc.SelectNodes("//a:AudioFiles/*", names);
if (0 == nodes.Count)
throw new InvalidDataException("No nodes in AudioFiles");
foreach (XmlNode n in xDoc.SelectNodes("//a:AudioFiles/*", names))
{
WebFileConfigImpl fileCfg = new WebFileConfigImpl(
n.Attributes["DirectoryForAudioFiles"].Value,
n.Attributes["AudioFileExtension"].Value);
senderConfigDictionary.Add(n.Attributes["MailSender"].Value, fileCfg);
}
}
示例3: InitProvider
public static IDBProvider InitProvider(DBType type, IPEndPoint ep, string user, string pwd, object other)
{
IDBProvider provider = null;
switch (type)
{
case DBType.MSSQL:
{
provider = new MSSQLProvider();
provider.Username = user;
provider.Password = pwd;
provider.SetConnectionBuilder(ep, user, pwd);
}
break;
case DBType.MYSQL:
{
}
break;
case DBType.ORACLE:
{
}
break;
default:
{
provider = null;
}
break;
}
return provider;
}
示例4: Put
public void Put(DBType typecode, int size, string value)
{
SortedList<int, string> map;
if (!weighted.TryGetValue(typecode, out map))
{
weighted[typecode] = map = new SortedList<int, string>();
}
map[size] = value;
}
示例5: ConvertDBTypeToNativeType
protected override void ConvertDBTypeToNativeType(IDbDataParameter p, DBType dbType)
{
if (SetSqlDbType == null)
{
SetSqlDbType = p.GetType().Module.GetType("System.Data.SqlServerCe.SqlCeParameter").GetProperty("SqlDbType", BindingFlags.Public | BindingFlags.Instance).GetSetter();
}
if (SetSqlDbType != null)
SetSqlDbType(p, (SqlDbType)(int)dbType);
else
base.ConvertDBTypeToNativeType(p, dbType);
}
示例6: Get
public string Get(DBType typecode, int size, int precision, byte scale)
{
if (size == 0 && precision == 0 && scale == 0)
return Get(typecode);
SortedList<int, string> map;
weighted.TryGetValue(typecode, out map);
if (map != null && map.Count > 0)
foreach (KeyValuePair<int, string> entry in map)
if (size <= entry.Key || precision > 0 || scale > 0)
return Replace(entry.Value, size, precision, scale);
return Replace(Get(typecode), size, precision, scale);
}
示例7: GetProvider
public static IHaveDbProvider GetProvider(DBType type)
{
switch (type)
{
case DBType.SqlServer: return new SqlServerProvider();
case DBType.SqlServerCE: return new SqlServerCEProvider();
case DBType.MySql: return new MySqlProvider();
case DBType.PostgreSQL:return new PostgresProvider();
case DBType.Oracle:return new OracleProvider();
case DBType.SQLite:return new SqliteProvider();
}
throw new Exception("Unkown provider");
}
示例8: GetDBTypeString
private static string GetDBTypeString(DBType dbType)
{
switch (dbType)
{
case DBType.Date:
return "Date";
case DBType.Integer:
return "Integer";
case DBType.NVarChar:
return "Nvarchar";
default:
return "Ntext";
}
}
示例9: button2_Click
private void button2_Click(object sender, EventArgs e)
{
DbSettings dialog = new DbSettings();
DialogResult result = dialog.ShowDialog(this);
if (result == DialogResult.OK)
{
DBType = dialog.DBType;
DbUser = dialog.DBUser;
DbPass = dialog.DBPass;
DbName = dialog.DBName;
DbAddr = dialog.DBAddr;
DbTNam = dialog.DBTNam;
}
}
示例10: GetDBDialog
public static IDBDialog GetDBDialog(DBType dbTypeName)
{
switch (dbTypeName)
{
case DBType.Oracle:
return new OracleDBDialog();
case DBType.MySql:
return new MySQLDBDialog();
case DBType.SqlServer:
return new SqlServerDBDialog();
default:
return null;
}
}
示例11: Create
public static IDBAccess Create(DBType type)
{
IDBAccess IRet = null;
switch (type)
{
case DBType.Access:
IRet = new Access(type);
break;
case DBType.SQL:
IRet = new SQL(type);
break;
default:
break;
}
return IRet;
}
示例12: GetStatementByDBType
public static string GetStatementByDBType(SQLStatementType statetype, DBType dbtype, object other)
{
string statement;
switch (statetype)
{
case SQLStatementType.EXISTSLM:
{
switch (dbtype)
{
case DBType.MSSQL:
{
statement = string.Format("select count(*) from master.dbo.sysobjects where xtype = 'U' and object_id(N'{0}') = id", Settings.Default.LMTABLE);
}
break;
}
}
break;
}
return null;
}
示例13: WorkingSet
public WorkingSet(string plantConnStr)
{
_dbType = Utility.GetDBType(plantConnStr);
_connStrs[Constants.SPPID_PLANT_SCHEMA] = plantConnStr;
if (Utility.GetDBType(plantConnStr) == DBType.ORACLE)
{
DataTable result = DBManager.Instance.ExecuteQuery(plantConnStr, Constants.ORACLE_GET_CURRENT_SCHEMA);
if (result != null && result.Rows.Count > 0)
{
_plantSchema = result.Rows[0][0].ToString();
}
}
else if (Utility.GetDBType(plantConnStr) == DBType.SQLServer)
{
//TODO: need to verify
_plantSchema = "dbo";
}
}
示例14: SqlType
SqlType(DBType dbType)
{
this.DbType = dbType;
hashCode = dbType.GetHashCode();
}
示例15: showForm
DB showForm(DBType t, DB db = null)
{
NewForm newForm = new NewForm(t);
if (db != null) newForm.db = db;
if (newForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
return newForm.db;
}
return null;
}