|
sorry jerry but it doesent work at my side
it still gives me 00:00:00 .
Data type of "StartTime" in database is "time"
Prafulla Vedante
|
|
|
|
|
Hi guys
We are working in ASP.Net Environment and most of the time we are facing 1 problem as follows
I have 1 aspx page, in that i have 2 frames now in the sacond frame i have "main.aspx" page is running in that i have Logoff button on click of that i want to redirect to Home.aspx page but if i use Response.Redirect("Home.aspx") then my Home page gets open in the second frame and my 1st frame that is my top frame remain as it is
So what i want is like when we use hyperlinks then we specify the nevigate page and then the target (where to open this link)
Eg: Navigate Page = "Home.aspx"
Target = "_parent"
then it get open that Home page in the browser.
So can we do the same kind of thing in the ASP.Net by using Response.Redirect
Please help me guys
Regards,
Harshad Pednekar
|
|
|
|
|
In an asp.net application, I use a COM object... this COM objects is stored in the session.
The COM object has methods that can last a long time (it sends info through a socket and wait for the reply). My problem is whenever I call a method of the COM object, it is always in the same thread which means that multiple users can block themselves out ( I know: I log the thread ID).
The COM threading model is apartment.... which should be OK.
All threads in asp.net are MTA.... which should be OK.
But the whole thing is not OK.. any idea? Thanks!
|
|
|
|
|
Hello BadJerry,
Although all threads in asp.net are MTA-based, your COM object remains an STA object. Hence at runtime, when your COM object is created, an STA apartment will be created (whose thread is the one for which you have tracked the ID) and the COM object will live there.
If your have the source codes for your COM object, you can change the apartment type to MTA but you must of course modify your code to make it suitable as an MTA object (using CRITICAL_SECTION objects, etc).
If you do not have the source codes to the COM object, I suggest creating an MTA object that exposes the same interface but internally aggregates all interface method calls to the original COM object. This should allow the asp.net client to make calls to other methods while the long time-consuming method is underway.
Hope the above helps,
Bio.
|
|
|
|
|
The above really helped... I thought the apartment threading model was MTA and it was STA... It took a bit of time to move my object to MTA... changing a #define, the inheritance from the com objects and the .rgs file but it is all done and it now works!
There was also the fact that AfxGetThrread()->m_nThreadID was incorrect which threw me but in the end, it works!
Thanks again for taking the time to write your message!
Bad(StillButABitBetter)Jerry
|
|
|
|
|
Hello BadJerry,
I'm really glad that things worked out
Best Regards,
Bio.
|
|
|
|
|
Hi all,
I'm trying to write comments in a cell using Automation for Excel 2003. I imported the all Excel Interfaces via VS .NET 2003. All interfaces for excel are based on COleDispatchDriver. I've caught the COleDispatchException but no error description was given. CCOleDispatchException.m_sc = -2146827284.
Ex:
//code has been reduced to bare minimum
//assume all necessary code has been created
CString myCommentText( "Making a statement" );
CRange cell( CWorksheet.get_Range( COleVariant("A1"),COleVariant("A1") ) );
VARIANT comment;
VariantInit( &comment );
comment.vt = VT_BSTR;
comment.bstrVal = myCommentText.AllocSysString();
//error occurs here
//when excel file is viewed, all comments written to it are there
//however the exception occurs when calling the function
cell.AddComment( comment );
SysFreeString( comment.bstrVal );
VariantClear( &comment );
Thank in advance
|
|
|
|
|
I get the same error from VBA. Can't you just trap the error, and if it's 1004, ignore it ?
Steve S
Developer for hire
|
|
|
|
|
I thought about that but I really want to know what is causing it. Besides I don't want to overlook something which may crash the app if left unchecked.
|
|
|
|
|
Currently I've found the solution. Instead of using AddComment, I'll begin using NoteText.
Returns or sets the cell note associated with the cell in the upper-left corner of the range. Read/write String.
Cell notes have been replaced by range comments. For more information, see the Comment object.
CRange .NoteText(Text, Start, Length)
expression Required. An expression that returns a Range object.
Text Optional Variant. The text to add to the note (up to 255 characters). The text is inserted starting at position Start, replacing Length characters of the existing note. If this argument is omitted, this method returns the current text of the note starting at position Start, for Length characters.
Start Optional Variant. The starting position for the text that's set or returned. If this argument is omitted, this method starts at the first character. To append text to the note, specify a number larger than the number of characters in the existing note.
Length Optional Variant. The number of characters to be set or returned. If this argument is omitted, Microsoft Excel sets or returns characters from the starting position to the end of the note (up to 255 characters). If there are more than 255 characters from Start to the end of the note, this method returns only 255 characters.
|
|
|
|
|
i wanna contruct a safearray,which is made up of VARIANT type element,which vt = VT_BSTR;i use SafeArrayCreate to create the safearray,then use SafeArrayPutElement to add element into array one by one,it's ok,and (this is just my test code) if i use SafeArrayGetElement to get the element that just now put into the array,on the neck of the SafeArrayPutElement at the same cycle statement,it's all right.
but if i write the SafeArrayGetElement out of the same cycle,the program
crashed.why?it's so strange.
my codes are as follows:
VARIANT *pvarCis = new VARIANT[nCount];
for(int i = 0;i < nCount;i++)
{
CComBSTR bstrCi(arCi.GetAt(i));
(pvarCis + i)->vt = VT_BSTR;
(pvarCis + i)->bstrVal = bstrCi.Copy();
}
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = nCount;
SAFEARRAY * psa = NULL;
psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
if(psa)
{
psa->cbElements = nCount;
VARIANT *pvarCellInfo = new VARIANT[nCount];
HRESULT hresult;
for(long lIndex = 0; lIndex < nCount; lIndex++)
{
hresult = SafeArrayPutElement(psa,&lIndex,&pvarCis[lIndex]);
if(FAILED(hresult))
return;
hresult = SafeArrayGetElement(psa,&lIndex,&pvarCellInfo[lIndex]);
if(FAILED(hresult))
return;
}
for(lIndex = 0;lIndex < nCount; lIndex++)
{
hresult = SafeArrayGetElement(psa,&lIndex,&pvarCellInfo[lIndex]);
if(FAILED(hresult))
return;
}
... ...
}
|
|
|
|
|
cbElements must equal the size of an element of the array. Try with:
psa->cbElements = sizeof(<code>VARIANT</code>);
"no xe tuto oro quel che luse"
rechi+
|
|
|
|
|
Hello XPointer,
I tried your sample source code and discovered that the error lies around the following lines :
if(psa)
{
//psa->fFeatures = FADF_VARIANT;
psa->cbElements = nCount; // <-- should not set cbElements.
...
...
...
The "cbElements" field is already set when you called the SafeArrayCreate() function earlier :
psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
Furthermore, this field indicates the size of each element of the array and since the element type has been declared to be VT_VARIANT, "cbElements" should be sizeof(VARIANT), i.e. 16 bytes, and should not be "nCount".
However the fields of the SAFEARRAY struct (including fFeatures) should all be transparent to developers and should only be accessed via APIs and not modified or accessed individually.
I suggest commenting out the line :
psa->cbElements = nCount;
Your code should work fine thereafter.
Best Regards,
Bio.
|
|
|
|
|
Hope this helps.. this creates a variant made of a safe array of variant which themselves are strings!
Just ignore the last 3 lines of code!
void CVariantTools::ToVariant(VARIANT & var,const CStringArray & arrColumns)
{
// Create the array
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = arrColumns.GetSize();
SAFEARRAY FAR* pArrayCol = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
// Fill it with the column property
for ( int nCol=0; nCol < arrColumns.GetSize(); nCol++)
{
long rgIndice=nCol;
COleVariant oleValue(arrColumns.GetAt(nCol),VT_BSTR);
SafeArrayPutElement(pArrayCol,&rgIndice,&oleValue);
}
// Prepare the variants
VariantClear(&var);
var.vt=VT_ARRAY|VT_VARIANT;
var.parray = pArrayCol;
}
|
|
|
|
|
thanks Bogdan Rechi, Lim Bio Liong and BadJerry ,
now i complete my src according to your advice,thanks.
btw,i just considerred 'the Size of an element' to 'the number of elements' by mistake,so the error occurred certainly.it's my carelessness
thanks a lot!!!
|
|
|
|
|
Hi guys,
I've got a ASP .Net application which uses a COM object. I've turned on impersonation and assigned a valid windows user. The system.security.principle.windowsidentity.getcurrent.name property correctly returns the logon user.
However, the COM is still running under the ASPNET identity. I know this because I've added a function in the COM object to return the current user(win32 API).
How do I overcome this problem? The COM object needs to run under a non ASPNET account in order for it to access another server.
Thanks.
|
|
|
|
|
I am attempting to create a class using C# or C++ that can be called from Visual Basic for Applications in Excel. I have tried several examples from CodeProject, Microsoft, and others, but whether I use the regasm utility or check the C# compiler option "Register for COM Interop", I get a message to the effect that there are no types that can be registered for COM Interop. I must be missing something obvious... any suggestions?
|
|
|
|
|
RegAsm registers any types that are public, do not have the ComVisible(false) attribute applied, and have a default constructor (one which takes no arguments). Also, any types used as parameters must be Automation-compatible. Any classes that are used as parameters must also conform to these requirements.
|
|
|
|
|
Thanks for the info. The Microsoft article does not mention the ComVisible attribute, which is obvious now that you've pointed it out. However, now I have another problem, which is that, when I select the add-in in the Automation Servers dialog box (Tools/Add-Ins/Automation Servers) in Excel, I get a message to the effect that it can't find mscoree.dll. That file's directory (C:\WINDOWS\system32) is included in the PATH environment variable, so it should be findable. Even copying mscoree.dll into the Excel application, add-in, or library directories does not help. Any suggestions?
|
|
|
|
|
Thanks for the info. The Microsoft article does not mention the ComVisible attribute, which is obvious now that you've pointed it out. However, now I have another problem, which is that, when I select the add-in in the Automation Servers dialog box (Tools/Add-Ins/Automation Servers) in Excel, I get a message to the effect that it can't find mscoree.dll. That file's directory (C:\WINDOWS\system32) is included in the PATH environment variable, so it should be findable. Even copying mscoree.dll into the Excel application, add-in, or library directories does not help. Any suggestions?
|
|
|
|
|
Hi,
I am building a word document using C# and Word .NET Programmability however I have a question that I cannot find the answer for.
I have designed the Word template with embedded bookmarks.
When I build the document I dynamically place text at each book mark position.
The base document also has some other fixed text in it.
However in the completed document the original text is always moved.
EG:
Original document
MyText More MyText
Completed document
MyText [C# Added Text] More MyText
It seems that the original text is moved along a number of tab spaces.
Is there anyway to prevent this so that the layout of the completed document is the
same as the original (the only difference is the added text)?
I know that the spaces I left in the template are sufficient for the text I want to add.
Any help/advice greatly appreciated.
Regards Andrew
|
|
|
|
|
Move your range to Range.Characters.Last and then try inserting text through c#. this will insert the text at EOD
Hope this helps
--------------
Pavan Kulkarni
|
|
|
|
|
Hello,
I have Visual C++ program that implements Graphical User Interface (GUI). This program uses CWinApp, CFormView, CFrameWnd, and CDocument.
Now I need to package this C++ application to work as COM DLL (or ActiveX).
This program must be used as popup window from another program written in Java.
Is it possible to convert Visual C++ program with GUI into COM DLL or ActiveX ?
|
|
|
|
|
Hi all,
I have a problem in identifying which click was pressed.
Iam building two groups A and B.Each group contains one textbox and add button(all are builded dynamically).If i click on add button it should add textboxes to respective group.For add button click iam adding attributes and incrementing value from javascript using a hidden variable.
btnAddRange.Attributes.Add("onclick","javascript:submitVIN('"+GroupId+"')") this is code for click on a button.How can we identify click is performed on respective group.
Any help is greatly appreciated.
Thanks,
Vijaya
vijaya
|
|
|
|
|
which application it is??(MFC APP)
|
|
|
|