Click here to Skip to main content
16,011,374 members
Home / Discussions / Database
   

Database

 
GeneralRe: ADO.NET and DSN Pin
Ray Cassick3-Sep-02 6:14
Ray Cassick3-Sep-02 6:14 
GeneralRe: ADO.NET and DSN Pin
Paul Riley3-Sep-02 7:20
Paul Riley3-Sep-02 7:20 
GeneralRe: ADO.NET and DSN Pin
Ray Cassick3-Sep-02 8:07
Ray Cassick3-Sep-02 8:07 
GeneralRe: ADO.NET and DSN Pin
Paul Riley3-Sep-02 9:01
Paul Riley3-Sep-02 9:01 
GeneralRe: ADO.NET and DSN Pin
Ray Cassick3-Sep-02 9:19
Ray Cassick3-Sep-02 9:19 
QuestionHow To? Pin
Hossam Abbas1-Sep-02 15:29
Hossam Abbas1-Sep-02 15:29 
AnswerRe: How To? Pin
Mazdak1-Sep-02 18:18
Mazdak1-Sep-02 18:18 
AnswerRe: How To? Pin
Nick Parker4-Sep-02 9:37
protectorNick Parker4-Sep-02 9:37 
Not sure what language you are going to be using, however the datatype is a BLOB, here is an example on how to do this with the .NET Framework in C#.
public void StorePicture( string filename )
{
  // Read the file into a byte array
  FileStream fs = new FileStream( filename, FileMode.Open, FileAccess.Read );
  byte[] imageData = new Byte[fs.Length];
  fs.Read( imageData, 0, (int)fs.Length );
  fs.Close();

  SqlConnection conn = new SqlConnection("");
  SqlCommand cmd = new SqlCommand("StorePicture", conn);
  cmd.CommandType = CommandType.StoredProcedure;
  cmd.Parameters.Add("@filename", filename );
  cmd.Parameters["@filename"].Direction = ParameterDirection.Input;
  cmd.Parameters.Add("@blobdata", SqlDbType.Image);
  cmd.Parameters["@blobdata"].Direction = ParameterDirection.Input;
  // Store the byte array within the image field
  cmd.Parameters["@blobdata"].Value = imageData;
  try
  {
    conn.Open();
    cmd.ExecuteNonQuery();
  }
  catch
  {
    throw;
  }
  finally
  {
    conn.Close();
  }
}


HTH

Nick Parker


GeneralDatabase Frontend Design Pin
Paul Silvernail30-Aug-02 2:23
Paul Silvernail30-Aug-02 2:23 
GeneralRe: Database Frontend Design Pin
Vagif Abilov31-Aug-02 2:48
professionalVagif Abilov31-Aug-02 2:48 
QuestionList user tables in a database?? Pin
Martin Haesemeyer29-Aug-02 3:09
Martin Haesemeyer29-Aug-02 3:09 
AnswerRe: List user tables in a database?? Pin
Mazdak29-Aug-02 3:46
Mazdak29-Aug-02 3:46 
GeneralRe: List user tables in a database?? Pin
Martin Haesemeyer29-Aug-02 7:35
Martin Haesemeyer29-Aug-02 7:35 
AnswerRe: List user tables in a database?? Pin
TigerNinja_29-Aug-02 4:50
TigerNinja_29-Aug-02 4:50 
GeneralRe: List user tables in a database?? Pin
Martin Haesemeyer29-Aug-02 8:38
Martin Haesemeyer29-Aug-02 8:38 
AnswerRe: List user tables in a database?? Pin
notadood29-Aug-02 8:41
notadood29-Aug-02 8:41 
AnswerRe: List user tables in a database?? Pin
Rein Hillmann13-Sep-02 6:19
Rein Hillmann13-Sep-02 6:19 
GeneralImport/Export problem Pin
Shaun Wilde27-Aug-02 6:31
Shaun Wilde27-Aug-02 6:31 
GeneralRe: Import/Export problem Pin
notadood27-Aug-02 8:24
notadood27-Aug-02 8:24 
GeneralRe: Import/Export problem Pin
Shaun Wilde27-Aug-02 8:52
Shaun Wilde27-Aug-02 8:52 
GeneralRe: Import/Export problem Pin
notadood27-Aug-02 10:22
notadood27-Aug-02 10:22 
GeneralRe: Import/Export problem Pin
Shaun Wilde27-Aug-02 21:08
Shaun Wilde27-Aug-02 21:08 
GeneralRe: Import/Export problem Pin
Shaun Wilde28-Aug-02 8:47
Shaun Wilde28-Aug-02 8:47 
GeneralSQL Debugging Pin
Shaun Wilde27-Aug-02 4:42
Shaun Wilde27-Aug-02 4:42 
GeneralRe: SQL Debugging Pin
notadood27-Aug-02 4:44
notadood27-Aug-02 4:44 

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.