473,804 Members | 2,109 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 3263

"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
6126
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
4729
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
12357
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
7312
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
3145
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
8717
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
3897
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
6540
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
8005
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
4267
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
9595
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
10604
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...
0
10354
jinu1996
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...
0
9177
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
7643
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
6870
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
5536
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...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3837
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.