|
I have an application writing out a Date/Time field into an Access database. On some computers the resulting table has 11/12/2004 for November 12, 2004 and on others it is 12/11/2004. The problem is that the second format when it is being read back in or queried on is being read as December 11, 2004.
Is there some setting I am missing here?
The app creates the database table, writes it and then queries on it yet runs differently on different computers because of this day/month switching.
Any ideas?
Thanks
"The world is a dangerous place to live, not because of the people who are evil, but because of the people who don't do anything about it."
Albert Einstein
Dave
|
|
|
|
|
Verify that the International settings for Date/Time are the same on each of the computers you are running on.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
|
|
|
|
|
Hey,
I was just fooling around with what appeared to me to be a relatively straightforward bit of code when Visual Studio gave me with the error that "the stack around the variable 'count' was corrupted". I ran it in the debugger and everything looked fine, up until the moment the error popped up, which was between return 0; and the closing brace. The problem also seems to be dependent on the value passed to srand(). I would assume it had something to do with the program being unable to deallocate its memory or something, but I really don't have a good guess. Any ideas?
<br />
int main()<br />
{ <br />
int count[10]={0};<br />
srand(3);<br />
for(int x=0;x!=50000;x++)<br />
{ <br />
count[(int)(rand()*10/RAND_MAX)]++;<br />
}<br />
<br />
for(int i=0;i!=10;i++) <br />
{<br />
cout<<"count["<
|
|
|
|
|
count[(int)(rand()*10/RAND_MAX)]++;
This will corrupt the stack if rand() == RAND_MAX because count[10] is invalid.
try this code instead:
count[rand() % 10]++;
John
|
|
|
|
|
Oh my, too early in the morning. Thanks.
|
|
|
|
|
The expression rand()*10/RAND_MAX yields values between 0 and 10; when it returns 10, you're writing out of the bounds of count , hence the problem (and the reason why it only pops up for certain values of
srand(...)<code>.) <br />
<br />
Joaquín M López Muñoz<br />
Telefónica, Investigación y Desarrollo<br />
<small>Want a Boost forum in Code Project? Vote <a href="http://www.codeproject.com/script/comments/forums.asp?msg=910893&forumid=1645&mode=all&userid=111#xx910893xx">here</a>[<a href="http://www.codeproject.com/script/comments/forums.asp?msg=910893&forumid=1645&mode=all&userid=111#xx910893xx" target="_blank" title="New Window">^</a>]!</small>
|
|
|
|
|
Hi,
I am trying to tell MSSQL Server running on a remote computer on LAN to back up a database on my computer. This is done through a application written in c++.
The Idea is to back up the database on the computer where the server is located as well as on the computer running the app.
What I did before this dual requirement was presented was create a stored procedure to backup the database which took the database name and the location to be backed up to as arguments.
It works well as SQL Server backs it on the local drive specified the path.
No if I send in the network address of my computer to do the same, SQL SERVER error log tells me that operating system denied permission ( which is what will be expected ).
I send in a string as \\computername\driverletter$\path\filename.zip
How can I modify this to include the user name and passwrod so that SQL SERVER can back it up on my computer without security problems???
I have tried net use kind of syntax but it does not help.
Please help!! this is really important.
Thanks In advance.
|
|
|
|
|
The simplest way is to backup the data on the server and then copy the file to your remote pc using SHFileOperation.
John
|
|
|
|
|
that will require me to logon to the server computer from the app before attampting the copy won't it?
|
|
|
|
|
Now when I think of it the user that is logged on has to be an admin for that to work. Sorry. I guess I have worked as an admin too long...
There are several ways around this. One way around is you can execute an application as a different user. I have done this in the past. Spawn an application that transfers the file as admin.
John
|
|
|
|
|
I tried using the SHFileOperation function.
I gives me an error copying the file which says that error reading the source disk or file.
This could be related to security issue, that windows will not let me copy the file from
the server to this machine which is running the application.
So the original problem is still there. I have the usernames and passwords of both computers(the DBServer and the host running application). How do I backup the DB to host or copy the already backedup file from Server???
|
|
|
|
|
I know. Unless you are logged in on the local pc as an admin on the server pc SHFileOperation will not work. Sorry.
John
|
|
|
|
|
but I am logged in as admin !!
The problem is how to tell windows that I have admin rights to the server when using the SHFileOperation function??
|
|
|
|
|
SHFileOperation uses the rights of the logged on user . Are you sure you passed the data correctly? Is your string double null terminated?
John
|
|
|
|
|
I believe there is NT documentation that claims this is not possible. I find that hard to believe.
Anyone ever found a way to create a true system environment variable, ie, not a user var or a process var, programmatically?
Thanks.
|
|
|
|
|
:(Hi there!
I have MFC app (doc/view). In that app I have a dialog with a combobox from which I want to transfer a selected item back to the main View Class where I have a VTK(Visualization toolkit) window. basically Selecting an item in the combobox should affect the object that Im displaying in my main View
when I execute my application and select the "Dialog" and select a string in the combobox it crashes and points at the member in the View class that I want to change.
Below is the code where I change a variable in the View method SetScalars.
I was wondering if it had to do with that my dialog is modal so that it cant overwrite my view class members , because that seems to be the problem.
John, that line "alot of functions and members.... " are just VTK (vizualization toolkit) stuff.
[CODE]
void CStressesDialog::OnDropDownSelchange()
{
int idx = m_DropDown.GetCurSel();
if( idx < 0 ) return;
CWnd* pParent = GetParent();
CVtkSDIView* pView = (CVtkSDIView*)pParent;
pView = (CVtkSDIView*)pParent;
CString str;
m_DropDown.GetLBText( idx,str );
pView->SetScalars(str);
}
[/CODE]
This is what causes the crash somehow this->str_select = s; where str_select is an Cstring.
[CODE]
void CVtkSDIView::SetScalars(CString s)
{
this->str_select = s;
//VTK STUFF IN THIS FUNCTION..
this->filereader->SetScalarsName(str_select);
this->filereader->Update();
this->lut->SetTableRange(this->filereader->GetOutput()->GetScalarRange());
this->lut->Build();
this->band->GenerateValues(15,this->filereader->GetOutput()->GetScalarRange());
this->band->Update();
this->pMapper->SetScalarRange(this->filereader->GetOutput()->GetScalarRange());
this->pMapper->Update();
this->renWin->Render();
this->iren->Start();
}
[/CODE]
Thanks for your help!
/regards
peter
|
|
|
|
|
what does the warning 'unreferenced local variable' mean ? how can i get rid of it ?
|
|
|
|
|
yellowtulips wrote:
what does the warning 'unreferenced local variable' mean ?
You declared a local variable which isn't referenced (You don't make any use of it)
yellowtulips wrote:
how can i get rid of it ?
Delete the declaration of the variable or use it for anything.
MS
|
|
|
|
|
|
I have a main (parent) MDI Application that launches another MDI Application. I have altered the title bar in the parent MDI App to display active security colors(all the time). When the child MDI App gets launched, especially when it's position comes up overlapping the parent App, I notice some weirdness with the mouse probably due to confusing framework messages as a result of the always active parent MDI title bar. The mouse will disappear behind the child MDI App window because it thinks it is still owned by the parent MDI App. I have tried to intercept the OnMouseActivate in the child's View class to no success. The parent title bar must stay active per requirements. Anyone know of a way I can relinquish mouse control to this child MDI App?
Thanks!
|
|
|
|
|
i have met the problem with designing a step by step program. can anyone help me with your source code or your ideal of designing a step by step program.
|
|
|
|
|
First you'll need to explain what a "step-by-step program" is.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Dear friendz....
i would like to know hoe i can change the color of the frame of a picture control placed on a dialog box when a certain event(say OnMouseMove())takes place??
all suggestionz are welcome.....
thanx in advance...
|
|
|
|
|
Hi,
I need to remove the lower combo box in a File Dialog (I mean the one which let you choose the file type). I've tried with HideControl(cmb1) where cmb1 is the ID of that combo box, but I can't hide it (the command works with the other two Combo boxes).
Notice: I'm using VS 2003.NET, the File dialog is a bit different from the old one.
Thanks
Vilmer
|
|
|
|
|
I've not tried this exact thing, but have done something similar. Derive a class from CFileDialog . At the end of the OnInitDialog() method, post a message. In the handler for that message, call ShowWindow(..., SW_HIDE) on the control you want to hide.
If you are not using MFC, you can do the same thing using GetOpenFileName() . Just specify a hook procedure in the lpfnHook member variable. In the hook procedure, handle the WM_INITDIALOG by posting the same message as mentioned before.
Hopefully this will solve your problem, or at least point you down the right path.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|