本文介绍了WCF Fb连接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用FirebirdSql.Data.FirebirdClient单元连接Firebird数据库.
当我尝试获取生成器的ID时,错误允许进入下一个单元.

我获得发电机ID的单元

I use FirebirdSql.Data.FirebirdClient unit to connect Firebird database.
Error allows in next unit when i trying get id of generator.

My unit where i get id of generator

public int GetId()
        {
            FbConnection fbcon = new FbConnection(OpenConnection());
            FbCommand getId = new FbCommand();

            getId.CommandType=CommandType.Text;
            getId.CommandText = "select GEN_ID(SOMEGENERATOR,1) from RDB$DATABASE";
            getId.Connection= fbcon;

            //fbcon.ServerVersion=;
            //fbcon.ServerVersionNumber=;

            fbcon.Open();


            FbDataReader fbrd=getId.ExecuteReader();
            fbrd.Read();

            return fbrd.GetInt32(0);
        }


像这样的错误:
索引超出范围.必须为非负数且小于集合的大小.参数名称:index


Error like this:
Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index

推荐答案


像这样的错误:
索引超出范围.必须为非负数且小于集合的大小.参数名称:index


Error like this:
Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index


这篇关于WCF Fb连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 02:15