473,778 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

blob

I'm using this code to get blob from sql server, but I get an error
"Parameter is invalid."

SqlDataReader sqlRead = null;

Image profile;
db.sqlConnectio n.Open();

System.Data.Sql Client.SqlComma nd ProfileBLOBSele ct = new
System.Data.Sql Client.SqlComma nd();

ProfileBLOBSele ct.CommandText = "dbo.[AppProfileSelec tIDBLOB]";

ProfileBLOBSele ct.CommandType = System.Data.Com mandType.Stored Procedure;

ProfileBLOBSele ct.Connection = db.sqlConnectio n;

ProfileBLOBSele ct.Parameters.A dd(new
System.Data.Sql Client.SqlParam eter("@RETURN_V ALUE",
System.Data.Sql DbType.Int, 4, System.Data.Par ameterDirection .ReturnValue,
false, ((System.Byte)( 0)), ((System.Byte)( 0)), "",
System.Data.Dat aRowVersion.Cur rent, null));

ProfileBLOBSele ct.Parameters.A dd(new
System.Data.Sql Client.SqlParam eter("@AppProfi leID",
System.Data.Sql DbType.UniqueId entifier, 16));

ProfileBLOBSele ct.Parameters["@AppProfil eID"].Value = row.AppProfileI D;

sqlRead = ProfileBLOBSele ct.ExecuteReade r();

if (sqlRead.Read() )

{

int iFileSize = sqlRead.GetInt3 2( 3 );

Byte[] arBuffer = new Byte[iFileSize];

sqlRead.GetByte s(4, 0, arBuffer, 0, iFileSize);

Stream str = new MemoryStream(ar Buffer);

str.Write(arBuf fer, 0, iFileSize);

profile = Image.FromStrea m(str); --> this one is invalid!

str.Close();

}


Apr 6 '06 #1
1 3260

"Hrvoje Voda" <hr*********@lu atech.com> wrote in message
news:e1******** **@ss405.t-com.hr...
I'm using this code to get blob from sql server, but I get an error
"Parameter is invalid."


This is code i use for getting crystals from blob.
I have not enaugh time for analysing your code but I hope so this will help
you.

{
string SQLappend="";
const string cQRY = "not so important";
DataSet DST = new DataSet("Crep_B LOB");
byte[] Arr_cRep = new byte[0];
DataRow DRow;

SqlDataAdapter SDA = new SqlDataAdapter( SQLappend, Conn);
SqlCommandBuild er CBuild = new SqlCommandBuild er(SDA);
SDA.Fill(DST, "Crep_BLOB" ); //table name

DRow = DST.Tables["Crep_BLOB"].Rows[0];
Arr_cRep = (byte[])DRow["crepdefaul t"];
int ArraySize = new int();
ArraySize = Arr_cRep.GetUpp erBound(0);
FileStream FStream = new
FileStream(@"c: \cRep_Temp\tRep ort.rpt", FileMode.OpenOr Create,
FileAccess.Writ e);
FStream.Write(A rr_cRep, 0, ArraySize);
FStream.Close() ;
FStream.Dispose ();
DRow.Delete();
}
Apr 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6122
by: Carolyn Longfoot | last post by:
Help! This is driving me crazy... I'm trying to read a BLOB from a db and display it in a browser, like so: $query="SELECT blob from table where blob_id=9"; $result=mysql_query($query); $blob=mysql_fetch_assoc($result); Now when I do print_r (array_values($blob));
3
4726
by: hamvil79 | last post by:
I'm implementig a java web application using MySQL as database. The main function of the application is basically to redistribuite documents. Those documents (PDF, DOC with an average size around 2Mb) are stored in BLOB column. The amount of documents for the first year should not exceed 5/6 Giga, but I cannot make prevision for the next years. Those documents are mainly just accessed (update and delete are not so
15
12350
by: Daniel Schuchardt | last post by:
Hi @ all, i'm sure there was a psql-function to transfere my Blob-Data to the server but I can't remember. I have a script like this : UPDATE xy SET z = lo_import('localpath_and_file'); but i want to execute this script from the client and so my blob-data is
3
7311
by: Carmine | last post by:
I have to add a date column to a db2/zos table with a blob column. Can I rename the blob table to old, create a new table with the date column, then insert/select the data from the old table? Do I have to select data from the main table and the aux table or is the aux table done automatically? What's the best way to handle this?
0
3141
by: Paul Kennedy | last post by:
I have a situation where I am utilizing code from MSDN to insert XLS files into a Microsoft Access Table in a column of Ole Object using VBA and DAO. That code also provides me with a method to extract the XLS files later. This works wonderfully. The Article is 103257, ACC: Reading, Storing, & Writing Binary Large Objects (BLOBs) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/oledb/htm/oledbaccessing_blob_data.asp I...
1
8714
by: Markusek Peter | last post by:
Hi, I'm using MySQLDriverCS. I've got no problem to store BLOB into database, but I can't get it back(save to file). Problem is with DataTable(returns string:( ) My code: -- DataTable dt = new MySQLSelectCommand(...; //select that row and column where is BLOB string dest = Server.MapPath("image.jpg"); FileStream binFile = new
0
3879
by: Biztalk Migration | last post by:
I am new to using BLOB with oracle stored proc. I dont knw how to set the size of the buffer which seems to overflow no matter what i used to pass it. I am getting an error System.Data.OracleClient.OracleException: ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "APPS.XXVAA_E_RECRUITMENT_HA_IF", line 13 ORA-06512: at line 1
2
6534
by: Vinciz | last post by:
hi guys... im new in java and i would love to learn some of these... basically i got a sample code to retrieve the blob from the mysql. however, i dont really know what to do with these retrieved byte/binary data as i got no idea on how to save them in our pc. For this situation, what i need to do is give the byte/binary data an extension (retrieved from another field in the table) in order to revert back to the original data i had in the...
9
8002
by: matt | last post by:
hello, im doing my first ASP.NET app that inserts & retrieves files from Oracle (no need for a discussion on *that*!). i learned first-hand of the somewhat awkward technique for inserting binary data into an Oracle BLOB column via ADO.NET. since my files are larger than 33k, it seemed had to use this technique: http://support.microsoft.com/default.aspx?scid=kb;en-us;322796
4
4263
by: skunapareddy | last post by:
I am needing to read a blob from database and pass it to another java program. I researched internet and found a program that reads a file on the client pc and gives bytes, but when I modified the code to read a blob from DB I am not having any luck, I am running this java programs using JDEVELOPER. Can anyone please give me some help? The code is as follows: ... private static byte getBytesFromBlob(Blob blob) throws Exception { ...
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9470
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,...
0
10298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10069
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,...
0
8957
agi2029
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...
1
7475
isladogs
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...
0
6723
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();...
0
5500
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.