Click here to Skip to main content
15,924,317 members
Home / Discussions / C#
   

C#

 
GeneralRe: Accessing Variables in a c# windows application Pin
vikas amin12-Aug-08 5:50
vikas amin12-Aug-08 5:50 
QuestionStrange problem with GetSchemaTable and utf8 Pin
stofel12-Aug-08 4:24
stofel12-Aug-08 4:24 
AnswerRe: Strange problem with GetSchemaTable and utf8 Pin
Wendelius12-Aug-08 7:57
mentorWendelius12-Aug-08 7:57 
QuestionEvent for handling exception during Application Close in winforms Pin
Rashmi_Karnam12-Aug-08 4:14
Rashmi_Karnam12-Aug-08 4:14 
AnswerRe: Event for handling exception during Application Close in winforms Pin
Manas Bhardwaj12-Aug-08 4:24
professionalManas Bhardwaj12-Aug-08 4:24 
AnswerRe: Event for handling exception during Application Close in winforms Pin
vikas amin12-Aug-08 5:37
vikas amin12-Aug-08 5:37 
GeneralRe: Event for handling exception during Application Close in winforms Pin
Rashmi_Karnam13-Aug-08 4:05
Rashmi_Karnam13-Aug-08 4:05 
QuestionHelp: Invalid Parameter Used error Pin
nudma12-Aug-08 4:08
nudma12-Aug-08 4:08 
Dear All!!!
Please help me to resolve this error from the code i m posting here...my image is stored in ms-access database
as OLE object under the field name img_stream. I get "Invalid parameter used" error at "bmp = new Bitmap(ms)"

private void Page_Load(object sender, System.EventArgs e)
{
myAccessConnection = new OleDbConnection(connStr);
openAccessConnection();
OleDbCommand myCommand = new OleDbCommand("select img_stream from tblImg where img_id=4", myAccessConnection);
OleDbDataReader reader = myCommand.ExecuteReader();
if(reader.Read())
{
MemoryStream ms = new MemoryStream();
Response.ContentType = "image/jpeg";
byte[] imageContent = (byte[])(reader["img_stream"]);
ms.Write(imageContent, 0, imageContent.Length);
Bitmap bmp;
bmp = new Bitmap(ms);
bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
ms.Close();
closeAccessConnection();
}
else
{
closeAccessConnection();
}
}
String connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("App_Data/db1.mdb");

OleDbConnection myAccessConnection;

protected void openAccessConnection()
{
if (myAccessConnection.State == ConnectionState.Closed)
{
myAccessConnection.Open();
}
}

protected void closeAccessConnection()
{
if (myAccessConnection.State == ConnectionState.Open)
{
myAccessConnection.Close();
}
}

Please help me out..This error is annoying me since last week and no solution yet!!
Thankyou!!!
AnswerRe: Help: Invalid Parameter Used error Pin
Rashmi_Karnam12-Aug-08 4:28
Rashmi_Karnam12-Aug-08 4:28 
GeneralRe: Help: Invalid Parameter Used error Pin
nudma12-Aug-08 6:03
nudma12-Aug-08 6:03 
GeneralRe: Help: Invalid Parameter Used error Pin
Rashmi_Karnam13-Aug-08 4:04
Rashmi_Karnam13-Aug-08 4:04 
GeneralRe: Help: Invalid Parameter Used error Pin
nudma13-Aug-08 4:36
nudma13-Aug-08 4:36 
GeneralRe: Help: Invalid Parameter Used error Pin
Rashmi_Karnam13-Aug-08 9:57
Rashmi_Karnam13-Aug-08 9:57 
GeneralRe: Help: Invalid Parameter Used error Pin
nudma14-Aug-08 4:43
nudma14-Aug-08 4:43 
QuestionString or binary data would be truncated. The statement has been terminated. Pin
laziale12-Aug-08 3:47
laziale12-Aug-08 3:47 
AnswerRe: String or binary data would be truncated. The statement has been terminated. Pin
vikas amin12-Aug-08 5:28
vikas amin12-Aug-08 5:28 
Questionrowchanged event and update error Pin
catborise12-Aug-08 3:10
catborise12-Aug-08 3:10 
AnswerRe: rowchanged event and update error Pin
catborise13-Aug-08 1:53
catborise13-Aug-08 1:53 
QuestionNeed Help Calling A Fortran 77 (.for) DLL Pin
Nitusa12-Aug-08 3:03
Nitusa12-Aug-08 3:03 
QuestionRegistering to an event on a wcf web service Pin
Lior Zat12-Aug-08 2:37
Lior Zat12-Aug-08 2:37 
AnswerRe: Registering to an event on a wcf web service Pin
c242312-Aug-08 3:47
c242312-Aug-08 3:47 
GeneralRe: Registering to an event on a wcf web service Pin
Lior Zat13-Aug-08 20:17
Lior Zat13-Aug-08 20:17 
Questionhow can i resolve System.Collections.ListDictionaryInternal Pin
koolprasad200312-Aug-08 2:26
professionalkoolprasad200312-Aug-08 2:26 
AnswerRe: how can i resolve System.Collections.ListDictionaryInternal Pin
leppie12-Aug-08 2:30
leppie12-Aug-08 2:30 
Questionenumeration of Active Sockets Pin
damcg12-Aug-08 2:07
damcg12-Aug-08 2:07 

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.