Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

sqlTransaction Complete Error-dataype was image now varbin..

 
   Database Help (Home) -> Client RSS
Next:  difference between DTS and SSIS.  
Author Message
Phil Johnson

External


Since: Jan 23, 2008
Posts: 3



(Msg. 1) Posted: Wed Jan 23, 2008 3:45 am
Post subject: sqlTransaction Complete Error-dataype was image now varbinary(max)
Archived from groups: microsoft>public>sqlserver>clients (more info?)

Hi,

This is being called in a C# loop within an ado.net transaction from C# 1.1
code. It is used to write large file data to a SQL Server database in
chunks, rather than in one go.

I had the stored procedure below, which worked until the image datatype was
changed to varbinary(max).

Now I get the following error:

This SqlTransaction has completed; it is no longer usable

The stored procedure is here (NOTE this is the version that works with the
dataype set to image. If I change the datatype to varbinary(max), and
obviously change the field in the table as well, the code fails with the
error given above).

ALTER PROCEDURE [dbo].[FileUploadData_Upd]
@FileID Uniqueidentifier,
--@data varbinary(max),
@data image,
@append bit
AS

SET NOCOUNT ON
IF @append = 0
UPDATE dbo.FileUpload
SET Data = @data
WHERE FileId = @FileID;
IF @append = 1
UPDATE dbo.FileUpload
SET Data.write(@data,NULL,0)


Any help would be appreciated

--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com

 >> Stay informed about: sqlTransaction Complete Error-dataype was image now varbin.. 
Back to top
Login to vote
Sean McCown

External


Since: Jan 23, 2008
Posts: 60



(Msg. 2) Posted: Wed Jan 23, 2008 7:20 am
Post subject: RE: sqlTransaction Complete Error-dataype was image now varbinary(max) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Run it directly from SQL and see if you get a better error message.

"Phil Johnson" wrote:

> Hi,
>
> This is being called in a C# loop within an ado.net transaction from C# 1.1
> code. It is used to write large file data to a SQL Server database in
> chunks, rather than in one go.
>
> I had the stored procedure below, which worked until the image datatype was
> changed to varbinary(max).
>
> Now I get the following error:
>
> This SqlTransaction has completed; it is no longer usable
>
> The stored procedure is here (NOTE this is the version that works with the
> dataype set to image. If I change the datatype to varbinary(max), and
> obviously change the field in the table as well, the code fails with the
> error given above).
>
> ALTER PROCEDURE [dbo].[FileUploadData_Upd]
> @FileID Uniqueidentifier,
> --@data varbinary(max),
> @data image,
> @append bit
> AS
>
> SET NOCOUNT ON
> IF @append = 0
> UPDATE dbo.FileUpload
> SET Data = @data
> WHERE FileId = @FileID;
> IF @append = 1
> UPDATE dbo.FileUpload
> SET Data.write(@data,NULL,0)
>
>
> Any help would be appreciated
>
> --
> Regards,
>
> Phillip Johnson (MCSD For .NET)
> PJ Software Development
> www.pjsoftwaredevelopment.com

 >> Stay informed about: sqlTransaction Complete Error-dataype was image now varbin.. 
Back to top
Login to vote
Phil Johnson

External


Since: Jan 23, 2008
Posts: 3



(Msg. 3) Posted: Wed Jan 23, 2008 2:38 pm
Post subject: RE: sqlTransaction Complete Error-dataype was image now varbinary( [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I will try that when I'm back in the office tomorrow.

Something I could add now is that it works if the file is small enough to
get loaded in the first 'chunk', so it only seems to happen when the second
call is made. This means the first call will run fine when the @append is
set to 0. The failure occurs after the C# code has executed the stored
procedure with the @append set to 0 then runs it again with the @append set
to 1.

Could the first call be causing the transaction to complete due to the
datatype being varbinary(max) rather than image?

Sounds very strange, but like I say, no changes to the C# code and if I
change the datatype back to image it all works fine.

--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com


"Sean McCown" wrote:

> Run it directly from SQL and see if you get a better error message.
>
> "Phil Johnson" wrote:
>
> > Hi,
> >
> > This is being called in a C# loop within an ado.net transaction from C# 1.1
> > code. It is used to write large file data to a SQL Server database in
> > chunks, rather than in one go.
> >
> > I had the stored procedure below, which worked until the image datatype was
> > changed to varbinary(max).
> >
> > Now I get the following error:
> >
> > This SqlTransaction has completed; it is no longer usable
> >
> > The stored procedure is here (NOTE this is the version that works with the
> > dataype set to image. If I change the datatype to varbinary(max), and
> > obviously change the field in the table as well, the code fails with the
> > error given above).
> >
> > ALTER PROCEDURE [dbo].[FileUploadData_Upd]
> > @FileID Uniqueidentifier,
> > --@data varbinary(max),
> > @data image,
> > @append bit
> > AS
> >
> > SET NOCOUNT ON
> > IF @append = 0
> > UPDATE dbo.FileUpload
> > SET Data = @data
> > WHERE FileId = @FileID;
> > IF @append = 1
> > UPDATE dbo.FileUpload
> > SET Data.write(@data,NULL,0)
> >
> >
> > Any help would be appreciated
> >
> > --
> > Regards,
> >
> > Phillip Johnson (MCSD For .NET)
> > PJ Software Development
> > www.pjsoftwaredevelopment.com
 >> Stay informed about: sqlTransaction Complete Error-dataype was image now varbin.. 
Back to top
Login to vote
Phil Johnson

External


Since: Jan 23, 2008
Posts: 3



(Msg. 4) Posted: Thu Jan 24, 2008 3:42 am
Post subject: RE: sqlTransaction Complete Error-dataype was image now varbinary(max) [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I should add, I have modified the datatype of the parameter in C# to be
varBinary:

SqlParameter paramData = cm.Parameters.Add("@data",
System.Data.SqlDbType.VarBinary);

And the isolation level of the transaction is ReadCommitted.

Also, I tried running the stored procedure directly in the Enterprise
manager and I did not get any errors with @append set to either 1 or 0.

--
Regards,

Phillip Johnson (MCSD For .NET)
PJ Software Development
www.pjsoftwaredevelopment.com


"Phil Johnson" wrote:

> Hi,
>
> This is being called in a C# loop within an ado.net transaction from C# 1.1
> code. It is used to write large file data to a SQL Server database in
> chunks, rather than in one go.
>
> I had the stored procedure below, which worked until the image datatype was
> changed to varbinary(max).
>
> Now I get the following error:
>
> This SqlTransaction has completed; it is no longer usable
>
> The stored procedure is here (NOTE this is the version that works with the
> dataype set to image. If I change the datatype to varbinary(max), and
> obviously change the field in the table as well, the code fails with the
> error given above).
>
> ALTER PROCEDURE [dbo].[FileUploadData_Upd]
> @FileID Uniqueidentifier,
> --@data varbinary(max),
> @data image,
> @append bit
> AS
>
> SET NOCOUNT ON
> IF @append = 0
> UPDATE dbo.FileUpload
> SET Data = @data
> WHERE FileId = @FileID;
> IF @append = 1
> UPDATE dbo.FileUpload
> SET Data.write(@data,NULL,0)
>
>
> Any help would be appreciated
>
> --
> Regards,
>
> Phillip Johnson (MCSD For .NET)
> PJ Software Development
> www.pjsoftwaredevelopment.com
 >> Stay informed about: sqlTransaction Complete Error-dataype was image now varbin.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Administrator logon rejected with ODBC Drivers error '8004.. - I'm running SQL Server 2000 under Windows 2000 Advanced Server. Authentication is set up as Windows Only. The Administrator account for the server is set up as an SQL user (this is done by default). I'm using the following ASP code to log onto a sample...

ADO Error in AdoConnection::open failed to create Connecti.. - Getting the subject event in the event viewer when trying to connect to a SQL2005 database from a workstation. My other workstations are not having this problem, so I'm sure it's related to this machine, but just can't figure it out. It's an XP Pro....

OLEDB: Prepared cmd with NULL input param for NOT NULL INT.. - Provider: SQLOLEDB Version: SQL Server 2000 8.00.760 Script for creating table: CREATE TABLE [dbo].[ADRVERTRETER] ( <font color=purple> ; [ROWID] [timestamp] NULL ,</font> <font color=purple> ; [ROWVERTRETER] [int] NO...

[MS Design Tools] - Class not registered.&quot; - On a Windows 2000 pro workstation I am using SQL 2000 enterprise manager I am trying to return all rows, I get the error message "An unexpected error happened during this operation. [MS Design Tools] - Class not registered." I have reinstall...

Need help choosing front end for SQL Server - I've been working on an Access 97 database that's pretty much reached it's limit in terms of performance and reliability. Although it supports relatively few users (5-10 concurrent) it contains a lot of data (around 30 tables, some with several million..
   Database Help (Home) -> Client All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]