這一切都沒有爲我工作,但它似乎都是很好的建議。我最終做的是世界上最大最糟糕的黑客攻擊。我希望完成的工作就是簡單地從SQLite數據庫加載數據庫表,並在DataGridView中顯示它(只讀,可排序的列)。實際的數據庫將在運行時以編程方式指定。我通過向表單添加DataGridView並使用嚮導來靜態定義數據庫連接字符串來定義DataSet。然後,我走進了Settings.Designer.cs文件,並添加了set
訪問到數據庫連接字符串屬性:
namespace FormatDetector.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("data source=E:\\workspace\\Test\\Matches.db;useutf16encoding=True")]
public string MatchesConnectionString {
get {
return ((string)(this["MatchesConnectionString"]));
}
set
{
(this["MatchesConnectionString"]) = value;
}
}
}
}
這是一個klugey黑客,但它的作品。關於如何清理這個爛攤子的建議不僅值得歡迎。
布賴恩
這實際上是什麼即時通訊在這裏做這行: bindingSource.DataSource = reader.GetDataTable(); – 2009-05-25 16:36:55