|
Hi,
Check that your character set is compatible at client side (HKEY_LOCAL_MACHINE\Software\Oracle....)
Mika
|
|
|
|
|
We have developed winform application in C#. Here when user logout we are storing logout time in database. Right now we have a code written in formclosing event for updating logout time. But if any error occurs while application is running / if we kill process from windows task manager then its not updating logout time. So please can any one suggest whats the best way to update logout time in Database. Because next time when user enters into application we are displaying message that "you are already logged in (System Name)system. Please logout!" . So if application is closed and logout time is not saved then user will get this message. So we want to update even if any exception in app / closed intentionally from task manager. Is there any event to handle this???
Please reply its very urgent.....
Rashmi.M.K
|
|
|
|
|
I don’t think that this (killing the application from Task Manager) can be handled with in the application itself.
And in fact, there can be n number of scenarios like this:
• What if I Shut Down my computer.
• What if there is hard disk crash.
|
|
|
|
|
Solution
1. Create a timer thread, that will send message if you dont get message application is dead .
2. Trace the Process of the application , if you dont find the process
the application is dead ( this has to be done from other process <new thread="" wont="" work="">, so u have 2 process )
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
thank u for good suggestion...
Rashmi.M.K
|
|
|
|
|
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!!!
|
|
|
|
|
Try this
{
byte[] imageContent = (byte[])(reader["img_stream"]);
MemoryStream ms = new MemoryStream(imageContent );
Bitmap bmp;
bmp = new Bitmap(ms);
bmp.Save(ms, ImageFormat.Jpeg);
closeAccessConnection();
}
Rashmi.M.K
|
|
|
|
|
Dear Sender!!!My error is still there..I have tried your instruction but no way out!!Please help...
|
|
|
|
|
Try this.. its working fine here.. i have executed your code its working.
{
byte[] imageContent = (byte[])(reader["img_stream"]);
MemoryStream ms = new MemoryStream(imageContent );
Image bmp = new Bitmap(ms);
bmp.Save(ms, ImageFormat.Jpeg);
closeAccessConnection();
}
Rashmi.M.K
|
|
|
|
|
I have tried your instruction but now i m getting following errors:
1. 'Image' is an ambiguous reference
2. The type or namespace name 'bmp' could not be found (are you missing a using directive or an assembly reference?)
I m using following namespaces:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
and i've used no image control...Please help!!!
|
|
|
|
|
u are reading image from Database. After this where do you want to display? what exactly you want to do?
Rashmi.M.K
|
|
|
|
|
Yes i m reading image from database and i want to display that on web page.
|
|
|
|
|
hi guys! I have a problem with the sql exception what I am getting while I am trying to upload a PDF file in a database. I have set the field for the document to be varbinary(MAX) so I will not have any problems with the size, but the exception says that my file is over the limit and I am getting this message when I am trying to update the table, at the last line of the code. Here is the code:
SqlConnection conn = new SqlConnection(some connection);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter("Select * FROM Table", conn);
SqlCommandBuilder MyCB = new SqlCommandBuilder(da);
DataSet ds = new DataSet("Table");
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
FileStream fs = new FileStream(@"C:\\PDFdocument"+"\\" + PDF, FileMode.OpenOrCreate, FileAccess.Read);
byte[] myData = new byte[fs.Length];
fs.Read(myData, 0, System.Convert.ToInt32(fs.Length));
fs.Close();
da.Fill(ds, "Table");
DataRow myRow;
myRow = ds.Tables["Table"].NewRow();
myRow["Document"] = myData;
myRow["ID"] = fileID;
ds.Tables["Table"].Rows.Add(myRow);
da.Update(ds, "Table");
how I can solve this issue? Thx ahead
|
|
|
|
|
|
i am trying to take under control of changing datarows. when there is a change i want to ask user whether he/she wants to save changes or discard changes. to accomplish this i am using rowchanged event
private void Form1_Load(object sender, EventArgs e)
{
this.kisiTableAdapter.Fill(this.denekDataSet.Kisi);
denekDataSet.Kisi.KisiRowChanged += new denekDataSet.KisiRowChangeEventHandler(Kisi_KisiRowChanged);
}
void Kisi_KisiRowChanged(object sender, denekDataSet.KisiRowChangeEvent e)
{
DataRowAction drc = e.Action;
if (drc == DataRowAction.Change)
{
DialogResult dr = MessageBox.Show("do you want to save changes!", "warning", MessageBoxButtons.YesNo);
if (dr == DialogResult.No)
{
e.Row.RejectChanges();
}
}
}
when there is a change this event works. and if user choice is "no" it works perfectly. but dialog result is "yes", there is a problem appears. changes are not apply to the database(restart the program). everything same as before the change action.
i tried different ways but it causes different errors(exception).
void Kisi_KisiRowChanged(object sender, denekDataSet.KisiRowChangeEvent e)
{
DataRowAction drc = e.Action;
if (drc == DataRowAction.Change)
{
DialogResult dr = MessageBox.Show("do you want to save changes!", "warning", MessageBoxButtons.YesNo);
if (dr == DialogResult.No)
{
e.Row.RejectChanges();
}else
{
kisiTableAdapter.Update(denekDataSet.Kisi);
}
}
}
after changing it calls many times messagebox for asking choice then produces InvalidOperationException and stops.
how can i solve this problem, it makes me anger and tired.
please help me , or show me a different way.
my intention is tracking changes and asking right question.
thanks for interests
::CTBRS::
|
|
|
|
|
there is not any answer, please help me.
::CTBRS::
|
|
|
|
|
Hey Everyone,
I am doing a VB6 to C# conversion and everything was going smoothly until I realized that I needed to call a Fortran 77 (.for) .dll inside my code. I have looked through everything I have found using Google and have still been unable to get it to successfully work. Currently the following call works about 75% of the time, but the other 25% of the time my program just calls the .dll and then it simply exits; no error/exception occurs, it just quits without executing anymore code. As you can see I have tried multiple ways to catch/generate error messages. I have no Fortran experience and I was told to leave the Fortran code alone, since it has been around and working since the 70’s.
From what I can tell the Fortran code only has one subroutine. I have included the header/parameters below:
SUBROUTINE FORTRANCALLA(INPUTL, TABLEL, NAMEL2, COMMAL, LOADL)
EXTERNAL F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F20
!DEC$ ATTRIBUTES DLLEXPORT :: FORTRANCALLA
!DEC$ ATTRIBUTES STDCALL, ALIAS: 'FORTRANCALLA' :: FORTRANCALLA
!DEC$ ATTRIBUTES REFERENCE :: INPUTL
!DEC$ ATTRIBUTES REFERENCE :: TABLEL
!DEC$ ATTRIBUTES REFERENCE :: NAMEL2
!DEC$ ATTRIBUTES REFERENCE :: COMMAL
!DEC$ ATTRIBUTES REFERENCE :: LOADL
CHARACTER(80), INTENT(IN) :: INPUTL
CHARACTER(80), INTENT(IN) :: TABLEL
CHARACTER(80), INTENT(IN) :: NAMEL2
CHARACTER(4), INTENT(IN) :: COMMAL
CHARACTER(80), INTENT(IN) :: LOADL
It appears C++ was used to wrap the .for file and generate a .dll which was called in the VB6 program using the following code:
Call Fortran.FORTRANCALLA(infilecalc, tablecalc, destination2, format, loadcond)
Public Declare Sub FORTRANCALLA Lib "Name.dll" _
(ByVal INPUTL As String, ByVal TABLEL As String, ByVal NAMEL2 As String, ByVal COMMAL As String, ByVal LOADL As String)
It appears that the VB6 program also has problems with the call, but not as frequently. However, it also handles the failed .dll call much better and does not crash. If possible I would just like my program not to fatally crash.
Here is the code I am currently working with and I am calling the exact same .dll that is currently being used in the VB6 version:
static class Fortran
{
[DllImport("Name.dll")]
private static extern bool FORTRANCALLA(
StringBuilder infilecalc,
StringBuilder tablecalc,
StringBuilder destination2,
StringBuilder format,
StringBuilder loadcond);
public static void Calculate(string infilecalc, string tablecalc, string destination2, string format, string loadcond)
{
string tempOutputPath = FileMod.GetTemporaryDirectory() + "NameTemp.tmp";
StringBuilder bldrInFileCalc = new StringBuilder(infilecalc, 80);
StringBuilder bldrTableCalc = new StringBuilder(tablecalc, 80);
StringBuilder bldrDestination2 = new StringBuilder(tempOutputPath, 80);
StringBuilder bldrFormat = new StringBuilder(format, 4);
StringBuilder bldrLoadCond = new StringBuilder(loadcond, 80);
try
{
if (!FORTRANCALLA(bldrInFileCalc, bldrTableCalc, bldrDestination2, bldrFormat, bldrLoadCond))
MessageBox.Show(new System.ComponentModel.Win32Exception().ToString());
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
//FORTRANCALLA(bldrInFileCalc, bldrTableCalc, bldrDestination2, bldrFormat, bldrLoadCond);
File.Copy(tempOutputPath, destination2, true);
File.Delete(tempOutputPath);
}
}
Right now I cannot find a pattern to the crashes. I could work with the same files, making identical calls to the .dll, and sometimes it works sometimes it doesn't. At first I thought it was something to do with memory allocation, but I don't think that is the case because sometimes it crashes on the first call. Sometimes it only crashes once, sometimes it crashes multiple uses in a row, and sometimes you can make many calls before it starts crashing again.
Does anyone have any ideas? Because I am officially out of ideas...
Thanks,
Nitsua
|
|
|
|
|
Hey guys, what up?
Kinda new to the message board. Hope I'm welcome
I have this problem with a web service; I'm writing a library which hosts a web service which holds an event as a member. Now I want to be able to add a delegate to that event from the library, which is of course not really possible through a web service method since a delegate is kinda like a function pointer.
Someone mentioned the possibility of using named pipes or some other kind of IPC. Does anyone know of such a solution? Can anyone here point me to an example of such implementation?
Thanks in advance,
LZ
|
|
|
|
|
Not sure how much this helps but you might be able to use reflection to achieve something similar? For example instead of storing a delegate, store the class & method name in a string, then use refelction to invoke...
Possibly not what you are looking for, but it might be an approach to consider if you don't get any other suggestions
Hope this helps,
Chris
|
|
|
|
|
I think reflection might help me out.. but I'm looking for a more elegant solution from WCF.
Does anyone know of such?
|
|
|
|
|
hello frnds,
i am trying to insert/select record to/from database.
but at the same time the databse throws me exception as
System.Collections.ListDictionaryInternal
how can resolve that exception ???
thankx in advnace
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
koolprasad2003 wrote: at the same time the databse throws me exception as
System.Collections.ListDictionaryInternal
That is definitely not an exception, please post the correct exception if you want us to help you.
|
|
|
|
|
I'm try to make a little to monitor for my sockets. I would like to get info on each connection, like end points, time connected, blah, blah. I have read few articles on sockets they appear to all be about creating new sockets. I just want list active connections. I would think that there is a .net object that does some thing like this but i seem to find it. Any suggestions? Thanks
|
|
|
|
|
|
Thank you but Socket.Select requires you to pass known sockets it. I need a way pulling the active sockets, I'm wanting to watch all Sockets on my box for activity
Thanks
|
|
|
|
|