Click here to Skip to main content
15,910,303 members
Home / Discussions / Database
   

Database

 
GeneralSQL query Pin
Paps28-Dec-04 3:49
Paps28-Dec-04 3:49 
GeneralRe: SQL query Pin
Yulianto.8-Dec-04 15:58
Yulianto.8-Dec-04 15:58 
GeneralRe: SQL query Pin
Alex Korchemniy8-Dec-04 17:02
Alex Korchemniy8-Dec-04 17:02 
GeneralRunning Batch Files - Windows Pin
sweep1237-Dec-04 22:24
sweep1237-Dec-04 22:24 
GeneralRe: Accessing SQL Server without static IP Pin
Steve S7-Dec-04 1:33
Steve S7-Dec-04 1:33 
GeneralRe: Accessing SQL Server without static IP Pin
Mekong River9-Dec-04 4:27
Mekong River9-Dec-04 4:27 
GeneralAccessing SQL Server without static IP Pin
johnie836-Dec-04 18:44
johnie836-Dec-04 18:44 
Generalprogress Pin
Yulianto.6-Dec-04 15:45
Yulianto.6-Dec-04 15:45 
GeneralRe: progress Pin
Dave Kreskowiak10-Dec-04 9:50
mveDave Kreskowiak10-Dec-04 9:50 
GeneralInvoke oracle job remotley Pin
RobNicolson6-Dec-04 4:44
RobNicolson6-Dec-04 4:44 
QuestionBLOBs: How to insert/store and get/retrieve an object? Pin
Rafferty Uy5-Dec-04 13:58
Rafferty Uy5-Dec-04 13:58 
AnswerRe: BLOBs: How to insert/store an object? Pin
Steve S6-Dec-04 1:32
Steve S6-Dec-04 1:32 
GeneralRe: BLOBs: How to insert/store an object? Pin
Rafferty Uy6-Dec-04 13:18
Rafferty Uy6-Dec-04 13:18 
GeneralRe: BLOBs: How to insert/store an object? Pin
Steve S7-Dec-04 1:30
Steve S7-Dec-04 1:30 
AnswerRe: BLOBs: How to insert/store and get/retrieve an object? Pin
Rafferty Uy8-Dec-04 17:01
Rafferty Uy8-Dec-04 17:01 
I'll try to summarize what i did for inserting and for retrieving the BLOBs in a pseudo-code level...

object obj1;<br />
object obj2;<br />
object obj3;<br />
<br />
InsertData()<br />
{<br />
  MemoryStream stream = new MemoryStream();<br />
  BinaryFormatter formatter = new BinaryFormatter();<br />
<br />
  Hashtable ht = new Hashtable();<br />
  ht.Add( "Object1", obj1 );<br />
  ht.Add( "Object2", obj2 );<br />
  ht.Add( "Object3", obj3 );<br />
<br />
  formatter.Serialize( stream, ht );<br />
<br />
  // Convert the Hashtable into bytes.<br />
  int iStreamLength = Convert.ToInt32(stream.Length);<br />
  byte[] byteBackup = new byte[iStreamLength];<br />
  stream.Read( byteBackup, 0, iStreamLength );<br />
  stream.Close();<br />
<br />
  SqlConnection conn = new SqlConnection( strConnectionString );<br />
  SqlCommand cmd = new SqlCommand( "ins_BackupData", conn );<br />
  cmd.CommandType = CommandType.StoredProcedure;<br />
  cmd.Parameters.Add( "@Name", "ObjectsBackup" );<br />
  cmd.Parameters.Add( "@Data", byteBackup );<br />
<br />
  cmd.ExecuteNonQuery();<br />
}<br />
<br />
RetrieveData()<br />
{<br />
  SqlConnection conn = new SqlConnection( strConnectionString );<br />
  SqlCommand cmd = new SqlCommand( "get_BackupData", conn );<br />
  cmd.CommandType = CommandType.StoredProcedure;<br />
  cmd.Parameters.Add( "@Name", "ObjectsBackup" );<br />
<br />
  conn.Open();<br />
<br />
  object obj = cmd.ExecuteScalar();<br />
<br />
  if( obj != null )<br />
  {<br />
    byte[] byteBackup = (byte[])obj;<br />
    MemoryStream stream = new MemoryStream(byteBackup);<br />
    BinaryFormatter formatter = new BinaryFormatter();<br />
<br />
    Hashtable ht = (Hashtable)formatter.Deserialize( stream );<br />
    obj1 = ht["Object1"];<br />
    obj2 = ht["Object2"];<br />
    obj3 = ht["Object3"];<br />
<br />
    stream.Close();<br />
  }<br />
}


But in retrieving the data I'm getting this error, so clearly there's something wrong. I wonder if it's with the insertion or retrieval or both.

ERROR:
Binary stream does not contain a valid BinaryHeader, 0 possible causes, invalid stream or object version change between serialization and deserialization.

Any ideas? did I deserialize this incorrectly?
GeneralADO .NET and Excel... :( :( HELP!! Pin
fadee4-Dec-04 10:15
fadee4-Dec-04 10:15 
GeneralString array to Oracle procedure from VB.Net Pin
Santhimurthy3-Dec-04 22:05
Santhimurthy3-Dec-04 22:05 
QuestionCan anyone help me with this one? Pin
Suresh Prasad3-Dec-04 10:40
Suresh Prasad3-Dec-04 10:40 
AnswerRe: Can anyone help me with this one? Pin
Mike Ellison3-Dec-04 11:13
Mike Ellison3-Dec-04 11:13 
GeneralRe: Can anyone help me with this one? Pin
Suresh Prasad3-Dec-04 11:29
Suresh Prasad3-Dec-04 11:29 
GeneralRe: Can anyone help me with this one? Pin
Mike Ellison3-Dec-04 11:48
Mike Ellison3-Dec-04 11:48 
GeneralRe: Can anyone help me with this one? Pin
Suresh Prasad3-Dec-04 11:57
Suresh Prasad3-Dec-04 11:57 
GeneralUploading Large numbers of records Pin
mjackson113-Dec-04 8:07
mjackson113-Dec-04 8:07 
GeneralRe: Uploading Large numbers of records Pin
Alex Korchemniy4-Dec-04 16:56
Alex Korchemniy4-Dec-04 16:56 
GeneralRe: Uploading Large numbers of records Pin
mjackson118-Dec-04 9:42
mjackson118-Dec-04 9:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.