Hi
I am executing a Sql Server SP from my C# app
One of the parameters is of type varbinary. Since the content length of this
parameter is variable I cannot set it to a pre-defined length. What do I set
the parameter size to ?
I can set it to -1 but does -1 means variable upto maximum size of Varbinary
type ?
Regards
Dilip 5 8314
Random thought; you could set it to the size of the (runtime) data you
are adding? or alternaviely int.MaxValue?
If the data is huge, and you don't want to allocate a large byte[] in
your C#, then you may wish to chunk the transfer. For SELECT this is
easy enough using one of the DataReader overloads, however, for saves
you need (unless I have missed this option) to do it manually: http://groups.google.com/group/micro...4e7e3782e59a93
Marc
dvarma wrote:
I am executing a Sql Server SP from my C# app
One of the parameters is of type varbinary. Since the content length of this
parameter is variable I cannot set it to a pre-defined length. What do I set
the parameter size to ?
I can set it to -1 but does -1 means variable upto maximum size of Varbinary
type ?
2000 : 8000
2005 : int.MaxValues
was obvious suggestions.
Arne
Actually, I believe that varbinary maps most closely to "image", so
was never subject to the 8000 page limit.
And (for the OP) another solution: simply don't set one! Not sure it
would be used for this data-type anyhows.
Marc
Marc Gravell wrote:
Actually, I believe that varbinary maps most closely to "image", so
was never subject to the 8000 page limit.
2000 BOL says:
varbinary [ ( n ) ]
Variable-length binary data of n bytes. n must be a value from 1 through
8,000.
2005 BOL says:
varbinary [ ( n | max) ]
Variable-length binary data. n can be a value from 1 through 8,000. max
indicates that the maximum storage size is 2^31-1 bytes.
So if the documentation can be trusted it was subject to the 8000 bytes
limit.
Arne
You are quite correct. I must have done a few too many translations
when reading it! So yes : if it is varbinary then you'd need to follow
the varbinary rules for that environment. I read it as "image" (hence
my comment), which can be added to SqlParamater using SqlDbType.Image ,
but is a pain to do through IDbDataParamete r and DbType.
Marc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Vinod |
last post by:
Hi,
I have a stored procedure which expects a varbinary datatype. How
can i pass a varbinary datatype from asp.net
directly to the stored procedure. I tried using the Convert function in Sql
server to convert the string to varbinary but it gives
a different value. Can you give me suggestions on how to approach this
problem.
The SQL server column datatype was made to varbinary because the data is in
hexadecimal format.
|
by: Dan |
last post by:
I'm storing a byte array in a varbinary field in a SQL
Server 2000 database, eg:
dim b() as byte = new byte() {1,2,3,4}
but when I attempt to retrieve the byte array (using
OdbcDataReader.GetBytes), my array contains different
information than what is stored.
When I query the field using query analyzer, the data
|
by: Roy |
last post by:
I have an object with array of some data types. How do I get the number of
bytes for it in managed code? The underlying data types could be primitive
types or userdefined structures.
For example I have an integer array boxed in object.
|
by: Dominique |
last post by:
Hello,
Im want to fix the width of a dashboard.
I have a field which has a field (in this dashboard on the left part of my
screen)
which could be long and make the right side of the screen out the display.
I wanted the size of the fiedl QueuedCountLabel fixed and the text inside
wrapped up and/or the dashboard itself with a fixed width.
I was trying a syntax as below:
|
by: Karch |
last post by:
I am doing some experimenting with serialization (for use with Service
Broker) and I am having a problem converting from a .NET DateTime (in the
client application) to a SqlDbType.VarBinary (as passed to the stored
procedure VARBINARY(MAX)) and then finally back to a valid DATETIME in Sql
Server. It seems I have tried everything, but I always get an error when
trying to convert the hex value representation of the byte array to a valid...
| |
by: Light |
last post by:
Hi all,
I posted this question in the sqlserver.newusers group but I am not getting
any response there so I am going to try it on the fine folks here:).
I inherited some legacy ASP codes in my office. The original code's backend
is using the SQL Server 2000 and I am testing to use it on the Express
edition.
And I run into the following problem.
|
by: Martin Horst |
last post by:
Hi,
I've got an application which is written in .Net 1.1. When I try to
write a varbinary(max) field using the SqlCommand and SqlParameter
classes I got an exception like this:
"The conversion of varchar into varbinary is invalid".
When I remove this field from my update statement, everything works
fine. The SQL paramter got the the DbNull value.
|
by: crystal2005 |
last post by:
Hi everyone,
I gonna ask how to set unlimited size of array of characters. According to the tutorial that i have found after amount of time of googling, array size should be defined when we declare it. In my task requirement, i'm gonna need 2D array to store the value of characters.
E.g.
char inputText; //20 characters is the maximum for each line
In my case, i will put the user into an unlimited input of characters until certain...
|
by: quintonmartin |
last post by:
Here's my problem.
I have a client application that uses a web service for data access. I can read/update many records in many tables, however, I am not getting what I expect for a varbinary(max) field I am trying to update.
Here's how I'm doing it.
I have a strongly typed dataset in c#. The column in question is defined as
System.Byte LogoImage,
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |