|
|
There's a walkthrough[^] on MSDN
Bastard Programmer from Hell
|
|
|
|
|
Hi,
I am working on an MVC application which is written in c#.
I am not able to save the httpposted file to my local folder while running the test case.But the same I am able to run from my controller and its working fine.Pelase find the code below.
string savePath ="c:/test.xlsx";
HttpPostedFileBase uploadedFile = files[0] as HttpPostedFileBase;
uploadedFile.SaveAs(savePath); //not saving the file to the path
can anyone pls help me on this.
Thanks in advance.
|
|
|
|
|
I don't know what operating system you are running, but after Windows XP the root directory has become protected. Software normally can't write to it without acquiring permissions first. Try creating a directory C:\Test and then try saving to C:\Test\Text.xlsx.
Also, you can check the return value or catch exceptions SaveAs throws so you can find out more about the specific error. My guess now is that it would be 'access denied'.
|
|
|
|
|
Was wondering if anyone has bumped into any show-stoppers developing .NET apps using an Apple Mac?
I need to support and develop iPhone, Andriod and Windows Phone apps and I'm thinking this might best be achieved on an Apple with a Windows7 bootcamp. Sounds good, looks good but I couldn't find much on the net re: developer experiences.
Anyone been there, done that?
"You get that on the big jobs."
|
|
|
|
|
So long as your running Windows in a virtual machine, no problem.
|
|
|
|
|
There are tools that allow iPhone and Android development on a PC. Unless you are doing the majority of your development for Apple I wouldn't bother with the hassles of trying to develop with a Mac.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
This appears to be a communications issue between .NET and SQL, so I've chosen to put it in the .NET category first.
Problem: A VB.NET app executed from a SQL stored procedure is unable to open a NamedPipe connection on a workstation. When the same app runs under CMD.EXE, the connection is successful. Unfortunately, the app must be initiated from SQL.
Environment: Server is Win Svr 2003 Enterprise, with SQL Server 2005 and .NET 2.0.50727.3620.
Workstation is Win 7 Pro
On the workstation, a job creates a NamedPipeServer (listener), then separately reads from a multicast broadcast. On the server, a stored procedure periodically runs, kicking off a VB.NET app which connects to the NamedPipe. This connection triggers the workstation job to update the SQL database.
This works fine when the workstation job (a VB.NET app) runs in a user context. However, it needs to run as a service on the workstation so that it can be running continuously, not be dependent on a particular user, and automatically restart if the workstation were to reboot.
When I coded it as a service, the workstation code does not see the NamedPipe connection request (triggered by a VB.NET app executed from a SQL stored procedure). It WILL work, however, if I run the "trigger" app on the same server under CMD.EXE.
Things I've tried:
-- Validated all user ids throughout the process, making sure the stored procedure is running under the same id as the workstation job.
-- Affirmed that SQL can actually run the trigger job.
-- Affirmed that the server can see the NamedPipe on the workstation. The existing (non-service) method works fine, the server connects to the NamedPipe, the NamedPipe listener collects the multicast data and sends it to the SQL database.
Something is different about kicking off the executable from SQL vs. CMD; my first thoughts were security, but I've made sure the stored procedure is running under the same id as the workstation job.
Has anyone run into something like this before? I'm guessing it's a trivial setting somewhere, but for the life of me I can't find it. Whatever help you can give me is greatly appreciated.
|
|
|
|
|
Presumably you collected the exact error - what was it?
There is nothing special about CMD versus any other application excluding the fact that CMD itself is an application.
You can of course use CMD itself to run your net app from SQL Server.
TrustTheMath wrote: but I've made sure the stored procedure is running under the same id as the workstation job.
How exactly?
I haven't tried it, and it may require some fooling about but it should be possible to get SQL Server to pop a CMD shell (console window). There might be a flag that you need to set to get this to work. If you do that then you can type anything you want in there. Including running the net app yourself.
|
|
|
|
|
Thanks for replying. There is no error -- none on either side. I've populated the code for the service with log msgs, and it shows that the service is sitting there waiting for a connection, but none comes. If the same .NET job runs from a CMD window, it does make the connection. Part 2 of your reply -- SQL (using EXECUTE AS) can run under a specified domain account; that is the same account used by the workstation when starting the service. In addition, the xp_cmdshell_proxy_account (which allows one to execute CMD) is set to the same domain account.
I'll try your suggestion about having SQL kick off the .NET job using CMD and having CMD initiate the .NET app -- something else at least to try. I've been kicking off the .NET app directly (i.e., xp_cmdshell "myapp.exe /parm=...").
|
|
|
|
|
TrustTheMath wrote: I've populated the code for the service with log msgs, <layer>and it shows that the service is sitting there waiting for a connection, but none comes.
For how long?
If a firewall blocks a connection then the connection will time out. That can take several minutes (or longer if someone has been messing with OS configurations.)
|
|
|
|
|
hello
i would like to change the background of the added row in a datagrid.
is there any way to get the added row and change its background?
Thanks
|
|
|
|
|
First please tell us the environment. The answer will be different between Windows and Web
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Defender-NF wrote: is there any way to get the added row and change its background?
Yes.
Without some context of what you environment you are trying to run this from, we can't really offer anymore help.
|
|
|
|
|
Ah sorry.
I m working on visual studio 2010 ultimate, wpf/c#
my datagrid are bound to some generic lists/datasets via simple itemsource-bindings.
Thanks
|
|
|
|
|
There are a few ways you could achieve this. Without knowing how you are going to determine what triggers a new colour, I can't be any more specific other than to say that you could look at using a different item template using an ItemTemplateSelector, or you could use a DataTrigger to set the background colour. Either mechanism would suffice.
|
|
|
|
|
Okay, so wich property can i use for the Trigger or the Datatrigger?
I mean is there something like "IsAdd" as a property? The only thing i found is "IsEditing" but i wanna the row change its background only if its a "new" row.
|
|
|
|
|
Defender-NF wrote: I mean is there something like "IsAdd" as a property?
No. If you think about it, the data grid will treat all rows initially as a new row because it has no interaction with the database. You will have to provide some context for it to be able to figure out what a new row is; for instance, you might have an IsSaved property on your data. The key is to look at the data, rather than at the datagrid for the mechanism to add this.
|
|
|
|
|
Thanks Pete for the Assistance
I already have some solutions for this based on my database.. but i dont wanna programm on all my classes/datasets/lists new property just to do this?
thats why i m looking on a interface-way to resolve that, or maybe an independency function or something, i tryed for example this:
void la2_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
{
emp.NewRowAfterFiltering = true;
}
}
NewRowAfterFiltering is a property wich i bound to the the datatriger of the gridrow to change background, but it didnt work.
|
|
|
|
|
ok i got it, but the rowbackground goes to the old value after the header got clicked, any idea how can i get in the way of that?
thanks
|
|
|
|
|
*********************************************************************************************
---------------> .aspx code <------------------------------------------------
<asp:gridview id="grdList" runat="server" autogeneratecolumns="False"
="" rowstyle-cssclass="tabe_3" alternatingrowstyle-cssclass="tabe_2" width="2400px" headerstyle-cssclass="tabe_1" datakeynames="truck_load_id" emptydatatext="Record not found...!!!" gridlines="None" pagesize="5" allowsorting="True" allowpaging="True" pagerstyle-cssclass="pager_style" onpageindexchanging="grdList_PageIndexChanging" onrowediting="grdList_RowEditing" onrowdeleting="grdList_RowDeleting" onsorting="grdList_Sorting" onrowcommand="grdList_RowCommand" >
="" <pagersettings="" firstpagetext="| First |" lastpagetext="| Last |" mode="NextPreviousFirstLast" nextpagetext="| Next |" <rowstyle="" cssclass="tabe_2" ><="" rowstyle>
="" <columns>
="" <asp:templatefield="" headertext="|| Truck Load Id ||" sortexpression="truck_load_id" <itemtemplate>
="" <asp:label="" text="<%# Bind("truck_load_id") %>" asp:label>
="" <="" itemtemplate>
="" asp:templatefield>
<="" column="">
*****************************************************************************************
*********************** CSS Code ********************
.tabe_1
{
margin:0px;
overflow:auto;
padding:0px 0px 0px 0px;
color:#0F7371;
font-weight:bold;
line-height:31px;
font-size:13px;
font-family:Verdana, Arial,sans-serif;
background:url(../images/tabe_1_bg.jpg) repeat-x top #F8F8F8;
}
.tabe_2
{
margin:0px;
padding:0px;
overflow:auto;
font-size:17px;
height:53px;
background:url(../images/rows_bg.png) repeat-x top #F3FDFE;
line-height:normal;
color:#000000;
vertical-align:middle;
}
.tabe_3
{
margin:0px;
overflow:auto;
padding:0px;
font-size:18px;
height:33px;
background:url(../images/rows_bg1.png) repeat-x top #F8F8F8;
line-height:normal;
vertical-align:middle;
}
*****************************************************************************************
|
|
|
|
|
|
Hi,
You can get solution to your problem here to change the background of the added row in a data grid. Using this you can set specific appearance of the element via Appearance property. For instance, Grid.Appearance, Header.Appearance, Column.Appearance, Row.Appearance, Cell.Appearance. Visit here and have a look http://www.dapfor.com/Feature.aspx?id=custom_painting[^]
|
|
|
|
|
Our application generally seems to work fine, but on one specific customer computer launching the application does absolutely nothing--our app doesn't even appear in the Processes list of the task manager. He can successfully run other .NET applications on his computer. Has anyone come across this kind of situation before? Thanks!
|
|
|
|
|
I haven't.
How do you launch it? Double-clicking the exe in Explorer, double-clicking aa shortcut somewhere, through a command line, batch file, another app calling Process.Start()?
Some of these ways allow for error checking, and could give some detailed information.
My best guess would be the app does start, immediately encounters a fatal problem and exits silently. Example: it tries and opens a logfile C:\mylog.txt however that particular system doesn't have a C: partition.
Suggestion: add some logging to your app, even a couple of MessageBox.Shows could be justified here.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|