Tag: firebird

DataTable.Load(FbDataReader)不会将所有内容加载到DataTable中

这里有一个密切相关的问题: .NET DataTable在Load(DataReader)上跳过行 我有一个返回169结果的SQL查询。 结果如下: CustomerID Customer Name TerminalID Creation Date 1 First Customer 12345 2010-07-07 1 First Customer 12346 2010-07-07 1 First Customer 12347 2010-07-07 2 Second Customer 23456 2011-04-18 这个结果是对的。 我在C#程序中输入了查询并执行它: public DataTable getDataTableFromSql(FbCommand command) { // Create a new datatable DataTable result = new DataTable(); // Set up the connection using (FbConnection […]

c#将数据添加到firebird数据库

我使用代码将新数据传递给Database(firebird): FbConnection fbCon = new FbConnection(csb.ToString()); FbDataAdapter fbDAdapter = new FbDataAdapter(“SELECT ID,name,score FROM players”,fbCon); FbCommandBuilder Cmd = new FbCommandBuilder(fbDAdapter); DataSet DSet = new DataSet(); fbDAdapter.Fill(DSet); DataRow rw = DSet.Tables[0].NewRow(); rw[“ID”] = zID + 1; rw[“name”] = var; rw[“score”] = score; DSet.Tables[0].Rows.Add(rw); fbDAdapter.Update(DSet); 也许你可以建议更好的算法,或者这是相当不错的?

NHibernate与Firebird ……是否启用了这些function?

我们正在使用NHibernate在Firebird后端取得巨大成功。 我的问题与Firebird支持的NHibernate中可用的function有关。 如果您对Firebird和NHibernate有任何专业知识,欢迎您提出意见。 Firebird是否支持“未来”查询? 从我的阅读中可以看出,Firebird是少数几个不支持此function的数据库之一。 有没有人有一个解决方法,因为“未来”将是一个很好的function来利用。 Firebird是否支持NHibernatefunction“prepare_sql”。 出于某种原因,我不能让它在Firebird中工作,并不断收到关于参数大小不相等的警告(在Nhibernate Profiler中)。 Firebird是否支持批处理? 在NHibernate映射中,我们指定批处理但是在分析器中看不到任何这种证据。 对于那些感兴趣的人,我们使用Fluent NHibernate来配置NHibernate。 一切运作良好,我们对ORM有很大的控制权,但只需要澄清上述内容。 你的意见?

带有Firebird客户端的.NET控制台应用程序在程序结束时崩溃

这是一个朋友的小项目,其目标是从给定的firebird数据库文件中读取数据并将其放入MS Office 2010模板中……因此Firebird作为数据库后端和.NET 4.x项目类型办公室的东西是给定的堆栈。 我写了一个小的(控制台)测试应用程序来与firebird嵌入式数据库客户端取得联系,并且已经有了我没有摆脱的第一个问题。 我的守则如下: using System; using System.Collections.Generic; using System.Linq; using System.Text; using FirebirdSql.Data.FirebirdClient; namespace TestFirebirdConnection { class Program { static void Main(string[] args) { // Set the ServerType to 1 for connect to the embedded server string connectionString = “User=sysdba;” + “Password=******;” + “Database=C:\\…\\…\\…\\PDATA.FDB;” + “ServerType=1;” + “Charset=NONE;”; try { FbConnection dbConnection […]

Firebird点网提供商没有完全执行查询?

我正在使用c#中的Firebird点网提供程序运行一些SQL命令。 具体来说,我正在更改数据库架构,并进行数据更新等。 作为我处理的一部分,我创建了一个新表,运行查询以从旧表中复制数据,然后删除旧表。 当我这样做时,firebird生成并出错: 不成功的元数据更新对象正在使用中 我做了一些寻找, 似乎复制数据的查询尚未“清除”我们或其他东西。 我的意思是当我在我的c#执行暂停时检查Firebird中的监控表时,我看到MON$STATEMENTS表中的查询为非活动状态。 这是在我运行commit语句之后。 我的问题: 在我尝试运行下一个命令之前,有没有办法暂停,等待或强制查询完全完成? 当我在ISQL中运行相同的查询序列时,它完美地运行。 有没有什么不同的ISQL,我可以强制点网Firebird提供商这样做,它不会保持这个查询打开或什么? 所以为了参考,代码看起来像这样(显然这是一个非常简化的): // create the table string commandString = “CREATE TABLE …”; // run the command in a transaction and commit it mtransaction = Connection.BeginTransaction( IsolationLevel.Serializable ); FbCommand command = new FbCommand(commandString, Connection, mtransaction); command.ExecuteNonQuery(); transaction.Commit(); transaction.Dispose(); transaction = null; // copy the […]

是否可以将大字符串写入Firebird blob?

Firebird的文档意味着您可以将大(> 60K)字符串写入表中的blob值。 所以,如果你有这个: CREATE TABLE MyBlobTable ( theId int PRIMARY KEY NOT NULL, theBlob BLOB SUB_TYPE 1 ) 那应该工作: insert into MyBlobTable (theId, theBlob) values (1, ‘[60K characters in a string]’) (示例受http://web.firebirdsql.org/dotnetfirebird/blob-sub_type-1-reading-example-csharp.html启发) 但我发现C#驱动程序和FlameRobin都无法写入此值。 你得到’意外的命令结束’(指向字符串中大约32K的位置,这有点可疑) 我认为有一种特殊的方式来引用或转义数据值,或者可能是这个Java代码(http://www.firebirdfaq.org/faq372/)的C#等价物,其中二进制文件直接读入语句。 我没有对文本数据做任何想象,所以如果需要,我可以将它存储为二进制blob。 谢谢! 更新:“参数化查询”是我正在寻找的短语。 我在做什么: FbParameter param = new FbParameter(“@blobVal”, FbDbType.Text); param.Value = myLargeString; String query = “insert into MyBlobTable (theId, […]

NHibernate firebird错误 – 索引超出范围

使用NHibernate和Firebird数据库时,c#中可能导致以下错误? 2015-08-17 08:27:04,962 [21] [(null)] ERROR Smartsign.Server.Core.Server Unhandled exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeException() at System.Collections.Generic.List`1.get_Item(Int32 index) at FirebirdSql.Data.FirebirdClient.FbParameterCollection.get_Item(Int32 index) in c:\Users\Jiri\Documents\devel\NETProvider\working\NETProvider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbParameterCollection.cs:line 58 at FirebirdSql.Data.FirebirdClient.FbParameterCollection.GetParameter(Int32 index) in c:\Users\Jiri\Documents\devel\NETProvider\working\NETProvider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbParameterCollection.cs:line 315 at System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item(Int32 index) at NHibernate.Type.Int32Type.Set(IDbCommand rs, Object value, Int32 […]

如何使用c#在firebird中执行事务(或多个sql查询)

我尝试了几种方法,包括在SO上。 以下MYSQL代码在Firebird中不起作用: CREATE TABLE publications ( INT NOT NULL AUTO_INCREMENT , PRIMARY KEY (`id`), filename varchar(500) not null unique, title varchar(500) DEFAULT NULL, authors varchar(1000) DEFAULT NULL, uploader int DEFAULT NULL, keywords varchar(500) DEFAULT NULL, rawtext text, lastmodified timestamp default CURRENT_TIMESTAMP ); 所以要在Firebird中实现这一点,我正在使用: CREATE TABLE publications ( id int NOT NULL PRIMARY KEY, filename varchar(500) […]

将Firebird连接到ASP.net WebAPI项目

我正在学习ASP.net,特别是WebAPI和MVC。 我正在使用Visual Studio Community 2013,.NET 4.5和C#。 我是一个全新的,所以我实际上正在通过这个特定的演练来了解事情是如何工作的: http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api 到目前为止一切正常,但我想继续连接数据库以填充我的数据集。 我非常熟悉使用Firebird并能够将Firebird安装为数据提供者(通过NuGet并安装相应的DDEX文件)。 不幸的是,我很难理解如何查询数据库并填充我的数组。 基本上,这就是我的代码: using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using FirebirdSql.Data.FirebirdClient; using System.Configuration; using System.Collections; namespace NBAPoolWebService.Controllers { public class UserController : ApiController { User[] users = new User[] { new User { ID = 1, CREATED=new DateTime(2011, 1, 12), […]

如何获取firebird数据库的独占锁以执行架构更改?

更具体地说,我正在使用firebird 2.1和DDEX Provider for visual studio,我正在使用c#。 我有一种情况,我试图从c#应用架构更改到数据库,以“更新”我的数据库。 在此过程中,我从firebird获得以下exception: FirebirdSql.Data.FirebirdClient.FbException:不成功的元数据更新对象INDEX正在使用中 我将此解释为一个容易出现的问题,其中有另一个进程同时访问数据库。 我不知道这是certian的原因,但它“似乎”是最可能的情况。 我认为它可能与删除和添加约束有关,因为它们不可添加,因为约束不正确,但我能够在本地系统上运行命令而不会出现错误,而不是在客户端站点上。 无论如何,我目前使用隔离级别“Serializable”将一些命令包装到一个事务中,并立即将它们全部提交。 由于这是升级,因此可以根据需要阻止所有其他用户。 例: // note connection is pre-defined as a FbConnection, connected to the Database in question FbTransaction transaction = Connection.BeginTransaction( IsolationLevel.Serializable ); // quite a bit of stuff gets done here, this is a sample // I can run all the commands […]