本文整理汇总了C#中ISchema.GetTables方法的典型用法代码示例。如果您正苦于以下问题:C# ISchema.GetTables方法的具体用法?C# ISchema.GetTables怎么用?C# ISchema.GetTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISchema
的用法示例。
在下文中一共展示了ISchema.GetTables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnGetTables_Click
private void btnGetTables_Click(object sender, EventArgs e)
{
//////////////////////////////////////////////////////////
//TODO: Dynamically load provider specific assemblies
//NOTE: There seems to be a bug in the way .NET loads
//assemblies in the GAC, so dynamic loading of an assembly
//does not work for me right now. Need to investigate
//string assemblyName =
// ConfigurationSettings.AppSettings
// ["SALAssembly"];
//string typeName = "com.common.sal.schema.SqlSchema";
//Assembly.Load("SqlSchema");
//////////////////////////////////////////////////////////
string connection;
connection = "Server=" + txtServer.Text + ";Database=" + txtDatabase.Text +
";User ID=" + txtUser.Text + ";Password=" + txtPass.Text;
//schema = Assembly.Load( assemblyName ).CreateInstance( typeName ) as ISchema;
schema = new SqlSchema( connection ) as ISchema;
if( schema != null ) {
//List user tables
try {
schema.Populate();
DataTableCollection dtc = schema.GetTables();
foreach( DataTable dt in dtc ) {
lbTables.Items.Add( dt );
}
//Alphabetical order
lbTables.Sorted = true;
}
catch( SchemaException se ) {
MessageBox.Show( se.Message, "SchemaException");
}
}
}
示例2: Schemas_OnSelectionChanged
private void Schemas_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
ClearSchema();
if (null == Schemas.SelectedValue)
return;
var schemaName = Schemas.SelectedValue.ToString();
if (String.IsNullOrEmpty(schemaName))
return;
_currentSchema = _currentProject.GetSchema(schemaName);
Tables.ItemsSource = _currentSchema.GetTables();
}
示例3: Schemas_OnSelectionChanged
private void Schemas_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
if (null == Schemas.SelectedValue)
return;
var schemaName = Schemas.SelectedValue.ToString();
if (String.IsNullOrEmpty(schemaName))
return;
_currentSchema = _currentProject.GetSchema(schemaName);
Tables.ItemsSource = _currentSchema.GetTables();
}
catch (Exception ex)
{
Dispatcher.Invoke(() => { LastStatusMessage.Text = "Error see output window"; });
OutputWindowMessage.WriteMessage("Error selecting schema:");
OutputWindowMessage.WriteMessage(ex.Message);
}
}