gpt4 book ai didi

asp.net - 如何在 ASP.NET 上使用 BLToolkit 连接 SqliteDB?

转载 作者:行者123 更新时间:2023-12-03 18:38:49 24 4
gpt4 key购买 nike

嗨,我在连接到我的 sqlitedb 时遇到错误。

我使用 Firefox Sqlite 插件创建我的 sqlitedb。

MyConn:(网络配置)

    <connectionStrings>
<add name="TARKMANCAS_CONNECTION" connectionString="Data Source=C:/TARKMANCAS_DB.sqlite;"/>
</connectionStrings>

我的课:
public TarkBaseDb()
: base("TARKMANCAS_CONNECTION")
{
}

// start
//
public Table<TarkBaseSchema.KadroGrubuCls> KadroGrubu { get { return GetTable<TarkBaseSchema.KadroGrubuCls>(); } }

TarkBaseSchema:
    [TableName("EGITIM_KADROSU_GRUBU_TAB")]
public class KadroGrubuCls
{
private TarkBaseDb db = new TarkBaseDb();

#region Contructors

public KadroGrubuCls()
{
using (db)
{
var qry = from x in db.KadroGrubu
select x;
foreach (var rec_ in qry)
{
KadroGrubuId = rec_.KadroGrubuId;
KadroGrubu = rec_.KadroGrubu;
}
}
}
#endregion

#region Data Items
[MapField("KADRO_GRUBU_ID")]
[PrimaryKey, NotNull]
public int KadroGrubuId { get; set; }
[MapField("KADRO_GRUBU")]
public string KadroGrubu { get; set; }

#endregion

#region Relations
#endregion

#region Public Methods

public KadroGrubuCls Get()
{
return (new KadroGrubuCls());
}

#endregion

}

并尝试调用电话:
TarkBaseSchema.KadroGrubuCls _tarkKadro = _tarkKadro.Get();

我得到错误:
  A network-related or instance-specific error occurred while establishing a connection to 
SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

最佳答案

错误消息显示它正在尝试连接到 SQL Server,而不是 SQLite。

更改连接字符串以选择正确的驱动程序。
(并且“数据”和“源”之间有两个空格。)

关于asp.net - 如何在 ASP.NET 上使用 BLToolkit 连接 SqliteDB?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12521390/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com