|
Τhe problem seems to be the regional setting of the other pc, which are different than mine.If they are change to the same as mine, it works
Hmmmmm
|
|
|
|
|
you could split the string ( string.Split() ) and then take the second index of a string array, then you have the number of the month, maybe you could work with that?
Here we rest... So why not make the best of it?
|
|
|
|
|
Not a good answer, study DateTime structure.
|
|
|
|
|
it seems you don't have a clue.
the only thing that could go wrong in tempor=Month(dgv1(0, counter).Value.ToString) is a NullReferenceException due to dgv1 or Value being null.
if there is a problem, it is bound to be in a different line. Look at the entire exception.ToString() output, tell your IDE to show line numbers, and get the line at fault.
Most likely it is about date formatting. The first thing about it is you have to decide whether you want a user-selected format (through Regional Settings), or a fixed format (specified explicitly in your conversions, see the Parse/TryParse method overloads that take explicit format info).
Luc Pattyn [Forum Guidelines] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Your problem is that you are storing your dates as strings. THIS IS WRONG AND VERY STUPID. This is error number 1 when a newbie starts working with dates. You should IMMEDIATELY go back and change your date storeage and manipulation from string to datetime.
Dates are subject to the computers cultureinfo, this means if the user has not changed the culture of the computer from the default american format (stupid friggin mm/dd/yyyy yank format) your 18 is being read as a MONTH, If it was a datetime format you would not have this problem.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Although i am not exactly newbie at programming, i admit i am relatively new to .net framework thing.
As i said on my second post, the problem was indeed the regional settings.The user had set them to American, and so it was reading 18 as Month, thus the error.
The reason i didn't use datetime in the field, is because the data are stored in a MS ACCESS database, and it was giving all sorts of problems trying to use the field.So many different bugs i don't even remember.
So i made them strings.
However i might give it one more shot to see what happens.
|
|
|
|
|
I would concur with the comments from Luc & Mycroft. Do not store dates and times as strings, it just leads to exactly this sort of problem. A DateTime value is universal and can be displayed in whatever format is required, and in many cases converted to a non-Gregorian calendar.
|
|
|
|
|
Johnkokk wrote: However i might give it one more shot to see what happens.
I would strongly recommend trying. You will almost certainly run into malformed dates already in the field which will produce error but then you will be fixing your data
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
how to read sms from any gsm mobile. anyone help me
|
|
|
|
|
Using what? c#? vb?W hat have you tried? Have you even looked on google?
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
when use you are application sms can not read from mobile. they give error.plz give solution
|
|
|
|
|
sanjay.gujarkar wrote: plz give solution
Doubtful, based on your question. Please try to be clear on what your problem is, with code and error messages if possible
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
I have a c# application that uses the Office PIAs to enable the application to export data to an Excel file. This works great on my development machine and other desktop machines.
When I run the application on a Terminal Server (which has Office available) I get a SecurityException and the application crashes. The debugger recommends I read up on security permissions and distributing office apps (helpfully providing a link). Going through this documentation, it seems to mostly pertain to writing add-ins for the Office suite instead of using their functionality.
Is there a tutorial that I can follow so I can preserve this functionality or at the very least disable the function and prevent the crash? Due to deployment issues I'd like to avoid modifying the .NET system policies if possible.
modified 12-Jul-20 21:01pm.
|
|
|
|
|
I had a command that inserted two tables, both using identity columns as primary keys. The identity value obtained from the first insert was used in inserting the second table, and two output parameters on the command should reflect the value of the two primary keys after insertion.
The command text was hence something like
INSERT A VALUES (@p1, @p2);
SET @A_ID = SCOPE_IDENTITY();
INSERT B VALUES (@p3, @p4, @A_ID);
SET @B_ID = SCOPE_IDENTITY();
I had added sql parameters for the identity values, and set the parameter direction to Output. After executing the command, I found that cmd.Parameters["@B_ID"].Value had been correctly set, but the @A_ID parameter invariably had the value zero.
Looking at the inserted data however what was really made me wonder what was going on here. The B record contained the correct foreign key, demonstrating that @A_ID had indeed been assigned correctly!
After hours of headscratching I stumbled upon the explanation: The code creating the command first added a parameter @A_ID as an input parameter, then added another parameter also named "@A_ID" as an output parameter. I don't know how exactly the provider communicates the variable declarations to SQL Server, but it appears that the second declaration simply overwrote (redeclared) the already-defined @A_ID. Then, when my code attempted to get the value, the SqlParameterCollection probably did a linear search returning the first parameter with a matching name, which of course was the input parameter.
While not checking for duplicate declarations may save a few microseconds, it would have been nice if by default such validation was performed and could be disabled instead via the ado.net configuration (for production). I certainly lost a lot of time, and probably some hair, before I found out. If it sounds like I was just being slow, let me add it wasn't that easy to check everything when the command had about 100 parameters.
|
|
|
|
|
Good find bro. I would surely try out this and see. If it really happens, it wouldnt be good.
dojohansen wrote: I was just being slow, let me add it wasn't that easy to check everything when the command had about 100 parameters.
Definitely.
|
|
|
|
|
Hi,
This is what I want to do.
- Want to display an HTML page in a browser, kioskmode.
- Depending on information I get through a webService, I need to change the URL.
Any suggestions/technology how to achieve this ?
Additionally, how can a browser render its HTML 'in the background', and when ready, swap the 'old content' with the newly 'rendered' content.
So, in the kioskmode, we avoid the 'building' being displayed to the viewer. Any idea ?
Thanks in advance !
Dirk
|
|
|
|
|
WinForms has a WebBrowser control[^] that you can use to display a web page on your form.
You could have 2 of the controls and keep one hidden, then do the reloading on the hidden one and switch them around when the rendering is complete.
As your app is just a win forms app you should be able to set it up as the endpoint for a WCF (or webservices or whatever) service and when it receives a message, you can load the appropriate URL in your browser controls.
Simon
|
|
|
|
|
Thanks for your prompt reply !
This indeed works. However, I have two additional questions
1) Can I know when the WebBrowser is finished rendering the page ?
and secondly
2) As being a newbee to WCF... do you have a good link to explain me
2.a) how to design the service
2.b) subscribe as endpoint.
Many thanks !!!
Dirk
|
|
|
|
|
Hi,
I have a website that's running from several months. Most of the web pages contain a common marquee tag. I want to put the tag in a html file and embed the html file wherever needed so that when ever a change is made to the marquee tag it affects all the web pages.
Thanks in advance
|
|
|
|
|
The easiest way is probably with Server Side Includes[^]
You put a tag like this in your main html page
<!--#include virtual="../TheOtherFile.html" --> which points to the other html file that contains the html you want to insert. The server (either IIS or Apache) will insert this file when the page is served.
This is something that I believe is turned on by default on IIS and Apache, but you may have to rename your main html to myfile.shtml to indicate that you want to process SSIs in the file. (This means that you may also have the change the default pages for your directories if you rely on default pages being default.html or something like that). Some of this may vary between providers though, so if in doubt check with your web host.
Simon
|
|
|
|
|
Didn't even know you could turn off server side includes. You definitely do not need to rename the file though. However aspx pages may not process server side includes. Not much point considering what they do.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
The Man from U.N.C.L.E. wrote: Didn't even know you could turn off server side includes. You definitely do not need to rename the file though.
You can[^], and you can also configure them to only be executed for specific file extensions, so it does depend on what your web host has got setup. My web host only processes SSIs on files named .shtml and .shtm. By default I think it's just on for all files, but you can't rely on that when you didn't do the IIS install yourself.
The Man from U.N.C.L.E. wrote: aspx pages may not process server side includes. Not much point considering what they do.
Yup, SSIs are not processed on aspx pages. You could probably hack up an alternative using something like Response.Write() , but like you say, not much point for asp. You'd probably just use something like master pages instead.
Simon
|
|
|
|
|
First, this would probably be better asked in the Web Development or ASP.NET forum since it has nothing to do with .NET Framework.
Have you considered using an asp.net master page?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Is it possible to write excel UDF with the help of build-in Visual Studio project type "Excel 2007 Add-In"?
|
|
|
|
|
Not that I know of... could be wrong though.
|
|
|
|