Click here to Skip to main content
15,906,645 members
Home / Discussions / C#
   

C#

 
GeneralRe: problem converting to object Pin
humayunlalzad14-May-08 19:57
humayunlalzad14-May-08 19:57 
GeneralRe: problem converting to object Pin
Guffa15-May-08 0:55
Guffa15-May-08 0:55 
GeneralRe: problem converting to object Pin
humayunlalzad15-May-08 5:09
humayunlalzad15-May-08 5:09 
GeneralRe: problem converting to object Pin
Guffa15-May-08 6:53
Guffa15-May-08 6:53 
GeneralRe: problem converting to object Pin
humayunlalzad15-May-08 7:33
humayunlalzad15-May-08 7:33 
AnswerRe: problem converting to object [modified] Pin
Peter Josefsson Sweden14-May-08 12:01
Peter Josefsson Sweden14-May-08 12:01 
GeneralRe: problem converting to object Pin
humayunlalzad14-May-08 19:48
humayunlalzad14-May-08 19:48 
Questioninserting an image into a database Pin
Ofori Boadu14-May-08 7:22
Ofori Boadu14-May-08 7:22 
I am trying to save in image into an MS SQl amd keep getting this error "Must Declare the Scalar Variable"
below is my code for the insertion;


OdbcCommand cmd = new OdbcCommand("INSERT INTO dbo.photo (photo) VALUES (@BLOBData)", myConnection);

//Save image from PictureBox into MemoryStream object.
MemoryStream ms = new MemoryStream();
picture.Save(ms, ImageFormat.Jpeg);

//Read from MemoryStream into Byte array.
Byte[] bytBLOBData = new Byte[ms.Length];
ms.Position = 0;
ms.Read(bytBLOBData, 0, Convert.ToInt32(ms.Length));

//Create parameter for insert statement that contains image.
OdbcParameter prm = new OdbcParameter("@BLOBData", OdbcType.VarBinary, bytBLOBData.Length, ParameterDirection.Input, false,0, 0, null, DataRowVersion.Current, bytBLOBData);

cmd.Parameters.Add(prm);
myConnection.Open();
cmd.ExecuteNonQuery();
myConnection.Close();
}
catch (OdbcException ex)
{
MessageBox.Show(ex.Message);
}

Any help?

a novice

AnswerRe: inserting an image into a database Pin
Giorgi Dalakishvili14-May-08 7:42
mentorGiorgi Dalakishvili14-May-08 7:42 
Questiondsp problems Pin
t.wegrewicz14-May-08 6:52
t.wegrewicz14-May-08 6:52 
Questionerror saving arabic chars into my sql server 05 db Pin
Boshkash14-May-08 5:21
Boshkash14-May-08 5:21 
AnswerIGNORE Pin
leckey14-May-08 8:18
leckey14-May-08 8:18 
QuestionHow to create the Setup file in C# Console Application in .Net Pin
bruze14-May-08 4:24
bruze14-May-08 4:24 
AnswerRe: How to create the Setup file in C# Console Application in .Net Pin
led mike14-May-08 4:29
led mike14-May-08 4:29 
GeneralRe: How to create the Setup file in C# Console Application in .Net Pin
parth.p14-May-08 5:48
parth.p14-May-08 5:48 
GeneralRe: How to create the Setup file in C# Console Application in .Net Pin
bruze14-May-08 6:38
bruze14-May-08 6:38 
GeneralRe: How to create the Setup file in C# Console Application in .Net Pin
parth.p14-May-08 7:23
parth.p14-May-08 7:23 
GeneralRe: How to create the Setup file in C# Console Application in .Net Pin
bruze14-May-08 20:31
bruze14-May-08 20:31 
QuestionGlobal dictionary & partial class scheme - error: cannot be accessed with an instance reference Pin
RNEELY14-May-08 4:09
RNEELY14-May-08 4:09 
AnswerRe: Global dictionary & partial class scheme - error: cannot be accessed with an instance reference Pin
carbon_golem14-May-08 4:24
carbon_golem14-May-08 4:24 
QuestionAny bug in my Code? Pin
ASysSolvers14-May-08 3:27
ASysSolvers14-May-08 3:27 
AnswerRe: Any bug in my Code? Pin
#realJSOP14-May-08 4:11
professional#realJSOP14-May-08 4:11 
Questionhow to use message box in windows service project. Pin
prasadbuddhika14-May-08 3:09
prasadbuddhika14-May-08 3:09 
AnswerRe: how to use message box in windows service project. Pin
Vikram A Punathambekar14-May-08 3:23
Vikram A Punathambekar14-May-08 3:23 
GeneralRe: how to use message box in windows service project. Pin
prasadbuddhika14-May-08 3:30
prasadbuddhika14-May-08 3:30 

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.