Subject | BLOB fileld headache |
---|---|
Author | Tutti Fruti |
Post date | 2005-05-11T21:18:04Z |
I'm using FireBird 1.5, Firebird NET Provider 1.7 and c#
Table STRINGS has columns
SID (int, PK)
ORIGINALSTRING (BLOB SUB_type 1)
I had to change ORIGINALSTRING to BLOB SUB_type 1 (was varchar (4000)),
because I needed unlimited length. Everything else works just fine except
for this method, which gives "internal error" when it tries to execute
rdr.Read();
Is "=" supported for blob fields? How on earth do I get the sid (or -1 for
null) if i know the originalstring? Thanks.
public int GetSid(string originalstring)
{
if (fbConn.State == ConnectionState.Closed) fbConn.Open();
FbCommand sql = fbConn.CreateCommand();
sql.CommandText = "SELECT SID FROM STRINGS WHERE ORIGINALSTRING=@orig";
sql.Parameters.Add("@orig",originalstring);
FbDataReader rdr = sql.ExecuteReader(CommandBehavior.CloseConnection);
//I need the last value of Sid
while (rdr.Read())
{
sid = Db2Int(rdr["SID"]);
}
rdr.Close();
return sid;
}
public static int Db2Int(object i)
{
if(i==System.DBNull.Value)
return -1;
else
return (int)i;
}
--
s.
Table STRINGS has columns
SID (int, PK)
ORIGINALSTRING (BLOB SUB_type 1)
I had to change ORIGINALSTRING to BLOB SUB_type 1 (was varchar (4000)),
because I needed unlimited length. Everything else works just fine except
for this method, which gives "internal error" when it tries to execute
rdr.Read();
Is "=" supported for blob fields? How on earth do I get the sid (or -1 for
null) if i know the originalstring? Thanks.
public int GetSid(string originalstring)
{
if (fbConn.State == ConnectionState.Closed) fbConn.Open();
FbCommand sql = fbConn.CreateCommand();
sql.CommandText = "SELECT SID FROM STRINGS WHERE ORIGINALSTRING=@orig";
sql.Parameters.Add("@orig",originalstring);
FbDataReader rdr = sql.ExecuteReader(CommandBehavior.CloseConnection);
//I need the last value of Sid
while (rdr.Read())
{
sid = Db2Int(rdr["SID"]);
}
rdr.Close();
return sid;
}
public static int Db2Int(object i)
{
if(i==System.DBNull.Value)
return -1;
else
return (int)i;
}
--
s.