From: F L <flo...@ho...> - 2003-08-22 07:46:11
|
Hello, >Which version of Firebird and .NET Provider are you using ?? I'm using Firebird 1.0.2 & .NET Provider 1.1 Alpha 2 >Can you send a test case ?? OK, well, I'm sending a snippet of the code I use. I've tried it different ways I still end up having an error somewhere. The thing is the app some times kind of freezes, but most of the times I get the same error. The error codes I get are 335544794 and 335544569. I've tried to pinpoint the problem exactly but the closest I've gotten to see where the error lies is that it complains that there is an unknown token, which is the ] in System.Byte[] that is passed as a parameter, which is the Byte array that has my file. Anyway, the code I use the get the byte array is this: string strPracticeBlob = this.txtDemoPic.Text.Trim(); FileStream fsPracticeBlob = new FileStream(strPracticeBlob, FileMode.Open, FileAccess.Read); Byte[] bytePracticeBlob = new Byte[fsPracticeBlob.Length]; fsPracticeBlob.Read(bytePracticeBlob, 0, bytePracticeBlob.Length); fsPracticeBlob.Close(); And then I call my procedure...(I omitted where I make the connection and all that before I use the command for the purpose of this mail) FbCommand myCommand = new FbCommand(); myCommand.CommandText = "EXECUTE PROCEDURE SP_INSERT_PROC(?,?,?,?,?,?)"; myCommand.Connection = connection; myCommand.Transaction = transaction; myCommand.CommandType = CommandType.StoredProcedure; // other parameters are added // bytePracticeBlob is a Byte[] myCommand.Parameters.Add("@PRACTICE", FbType.Binary).Value = bytePracticeBlob; myCommand.ExecuteNonQuery(); transaction.Commit(); myCommand.Dispose(); the error happens at ExecuteNonQuery() Any ideas? Let me know if more code is needed to pinpoint my problem. Thanks again for your help. Lopez _________________________________________________________________ Get MSN 8 and help protect your children with advanced parental controls. http://join.msn.com/?page=features/parental |
From: F L <flo...@ho...> - 2003-08-22 17:31:53
|
>I can suggest you to get the 1.5 Alpha 1 :) I did, but then my previous code wasn't working. I think it was something about the way the procedure is called. So I went back to 1.1 >Thanks, i have a test case like this ( tell to me if it's correct ), seems >to be working ok for a single execution, i'm going to make test using a >loop ( the test case uses 1.5 alpha 1 ): The code is pretty much the same as what I do. Just that I use a file, and then get the bytes from it. >And the stored proc: >CREATE PROCEDURE NEW_PROCEDURE ( > INT_PARAM INTEGER, > BLOB_PARAM BLOB SUB_TYPE 0 SEGMENT SIZE 80) >AS >begin > INSERT INTO TEST_TABLE_01 (INT_FIELD, BLOB_FIELD) VALUES (:INT_PARAM, >:BLOB_PARAM); >end On the procedure however, I did not write the sub_type nor the segment size for the blob. Could that be it? Anyway, when I use my procedure using isql, and put a null for my field, the procedure works just fine and adds the entry correctly. When I send a null through code however, I wind up witn an error. I'll try to see if with 1.5 things work out and I'll keep you posted. Meanwhile, if there are any ideas of what's going on, please let me know. Thanks for your help, Lopez _________________________________________________________________ Get MSN 8 and enjoy automatic e-mail virus protection. http://join.msn.com/?page=features/virus |
From: Carlos G. A. <car...@te...> - 2003-08-22 17:41:19
|
Hello: > I did, but then my previous code wasn't working. I think it was > something about the way the procedure is called. So I went back to 1.1 I encourage you to make another test with the 1.5 and comment here your problems :) think in that 1.1 was discontinued. > The code is pretty much the same as what I do. Just that I use a file, > and then get the bytes from it. :) i have tested it with a loop and works ok too :) > On the procedure however, I did not write the sub_type nor the segment > size for the blob. Could that be it? Segment size probably not but can be good to set the sub type for ensure that the parameter is a binary blob. > Anyway, when I use my procedure using isql, and put a null for my field, > the procedure works just fine and adds the entry correctly. When I send > a null through code however, I wind up witn an error. Huummm i'm going to test the same using a null, thanks :) > I'll try to see if with 1.5 things work out and I'll keep you posted. > Meanwhile, if there are any ideas of what's going on, please let me know. Thanks :) -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: Carlos G. A. <car...@te...> - 2003-08-22 17:47:19
|
Hello: > Huummm i'm going to test the same using a null, thanks :) Seems to be working for me using 1.5, here is the test case: FbConnection connection = new FbConnection(connectionString); connection.Open(); FbTransaction transaction = connection.BeginTransaction(); // Creates a new command and inserts data FbCommand command = new FbCommand("new_procedure", connection, transaction); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@INT_PARAM", FbDbType.Integer).Value = (int)(System.DateTime.Now.Ticks / 100000); command.Parameters.Add("@BLOB_PARAM", FbDbType.Binary).Value = null; command.ExecuteNonQuery(); command.Dispose(); transaction.Commit(); connection.Close(); -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: Carlos G. A. <car...@te...> - 2003-08-22 08:27:43
|
Hello: >> Which version of Firebird and .NET Provider are you using ?? > > I'm using Firebird 1.0.2 & .NET Provider 1.1 Alpha 2 I can suggest you to get the 1.5 Alpha 1 :) > Any ideas? Let me know if more code is needed to pinpoint my problem. Thanks, i have a test case like this ( tell to me if it's correct ), seems to be working ok for a single execution, i'm going to make test using a loop ( the test case uses 1.5 alpha 1 ): byte[] bytes = new byte[100000*4]; RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); rng.GetBytes(bytes); FbConnection connection = new FbConnection(connectionString); connection.Open(); FbTransaction transaction = connection.BeginTransaction(); FbCommand command = new FbCommand("new_procedure", connection, transaction); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@INT_PARAM", FbDbType.Integer).Value = System.DateTime.Now.Millisecond; command.Parameters.Add("@BLOB_PARAM", FbDbType.Binary).Value = bytes; command.ExecuteNonQuery(); transaction.Commit(); command.Dispose(); connection.Close(); And the stored proc: CREATE PROCEDURE NEW_PROCEDURE ( INT_PARAM INTEGER, BLOB_PARAM BLOB SUB_TYPE 0 SEGMENT SIZE 80) AS begin INSERT INTO TEST_TABLE_01 (INT_FIELD, BLOB_FIELD) VALUES (:INT_PARAM, :BLOB_PARAM); end -- Best regards Carlos Guzmán Álvarez Vigo-Spain |