|
Thank you all.
Best,
Morten
|
|
|
|
|
how should I debug this error which says "Input string was not in a correct format"
Here is the code:
private void frmLogin_Load(object sender, EventArgs e)
{
this.Visible = false;
if (FWFAddin.userid == "")
{
FWFAddin.FWFAppSettings fwfreg = new FWFAddin.FWFAppSettings();
long dtNow = DateTime.Now.Ticks;
long dtThen = long.Parse(fwfreg.LoginTime()); //I get an error here
long dtFinal = dtNow - dtThen;
if (dtFinal > 36000000000)
|
|
|
|
|
Insert the following before the parse attempt.
string testString = fwfreg.LoginTime().ToString();
Then set a breakpoint.
You can also use TryParse , which catches the exception internally for you and returns true or false.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
What does fwfreg.LonginTime() return? What does the string look like there?
|
|
|
|
|
Hy!
I want to play with WPF but I can't.
I have installed .NET Framework 3.0 and Visual Studio 2005.
What I need to install to learn WPF?
I hear about an ORCAS extension and a Windows SDK but I don't know where I fount these.
thx
|
|
|
|
|
|
Hi,
I'd like to develop a simple Windows application in which I have a rich text box (on which I have a tight control) and a version management system handling the files I'm editing, so that I dont modify my original text file, and I can come back to a previous version.
Like I want to integrate the check in and check out in the editor, but I want to give the editor some features I dont find in standard editors (for my private needs).
Is C# the wrong language for this? Like I've invested a lot of time learning it,
it would libraries to handle this would be written in C++ but
I'd rather avoid the complexities of C++.
|
|
|
|
|
Hi,
I did my own IDE in C#. It includes a full featured text editor, which is not based on
a RichTextBox, instead I use my own data structures and paint everything to a Panel myself.
This allows me to implement all the things I want without being hindered by the peculiarities (shortcomings?) of an RTB. An RTB is not very good at handling large files for one. And
I have seen many posts struggling with syntax coloring; I do mine inside the Paint handler,
just coloring the part that is visible. This works just fine, supporting a whole set of
languages.
I did not interface to a version management system yet, but that can't be very difficult.
Conclusion: I did all this once in Java, later on a repeated and extended it in C#.
These are the only languages I would want to do it in right now!
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Yes, I agree about the weakness of the RTB.
Actually I saw a built-in editor control that was very nice in TKInter that comes with Python, because it has marks and tags, which I think I need.
A mark represents a floating position somewhere in the contents of a text widget. A tag is like, well, a pair of marks under the one name, which defines a range of characters and those characters can be given a font, a color and other nice properties.
Now if I could get that in C# I'd be happy. Maybe I should build my application
in Python...
|
|
|
|
|
Hi all , Have a good day
I hope this is the right place for posting my question ..
Dear developments , I am using VS 2003 .NET 1.1
I need to know about Crystal report those things ( if you don't mind )
1 - What is My Crystal Report Version ?
2 - Is My VS Crystal report enough for Making and Designing Complex report
and aligement Tables such as this :
|-----------|--------------------|
| Name | Phone Number |
|-----------|--------------------|
| Stark | XXX-XXXX-XXX |
|-----------|--------------------|
3 - Is There is a Free External Tool Better Than VS .NET 1.1 For making RPT
Files (or Excellent External tool from Microsoft ) ?
Thank you all for reading , answering , and even Passing ...
Kind regards ...
I know nothing , I know nothing
|
|
|
|
|
What are you trying to accomplish?
|
|
|
|
|
An atomic bomb ?
I know nothing , I know nothing
|
|
|
|
|
Huh? That really makes no sense.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Writing application with Visual Studio 2005 using C# connecting with remote SQL Server 2005. I have a form "Workorder" with a textbox bound to datetime column. I am not using a datetime picker or month calendar. My problem is if the textbox has an existing date in it, I cannot delete the date and put NULL back into the column. The column is set to allow NULLS and the default value is NULL on both the dataset and the remote server. I was connecting to the server with MS Access 2003 before and did not have this problem. I know it is possible with C# but have been unable to make it happen. Basically, I want to put NULL back into the column on an existing record.
Any help is greatly appreciated.
Richocet
Always pushing to the next level.
|
|
|
|
|
Richochet wrote: Any help is greatly appreciated.
Help[^]
|
|
|
|
|
// dtData is your DataTable...
// n is whatever row your at..
dtData.Rows[n]["DateColumnName"] = DBNull.Value;
|
|
|
|
|
Take a look at using DBNull.Value.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi guys,
i want to search in the sqlserver database table for words that the user of my app types in a textbox...i select now * from the table and fill the dataset. now how can i iterate trough the DataTable to search the input? or is there a better way to do this? can u give me some code pls thanx
|
|
|
|
|
You'd be better off creating a stored procedure that takes the contents of the textbox as an argument.
Base your select statement on the arguement.
Something like
<br />
<br />
Create procedure FindWords @words varchar(max)<br />
as <br />
SELECT * from yourtable where yourfield like @words<br />
<br />
Then you don't have to worry about iterating over the dataset.
"You're very clever, young man, very clever," said the old lady. "But it's turtles all the way down!"
|
|
|
|
|
Thanx duncanmhor for your response,
the problem is that we don't use stored procedres in this project. so i have to use the iteration.
|
|
|
|
|
Djavid j wrote: i select now * from the table
Djavid j wrote: we don't use stored procedres in this project. so i have to use the iteration.
ummm no, that is not your only option.
|
|
|
|
|
DataTable dtSample = new DataTable();<br />
<br />
<br />
for(int i = 0; i < dtSample.Rows.Count; i++)<br />
{<br />
if(dtSample.Rows[i]["ColumnName"].ToString() == "some data")<br />
{<br />
}<br />
}<br />
dtSample.Dispose();<br />
|
|
|
|
|
Djavid j wrote: the problem is that we don't use stored procedres in this project. so i have to use the iteration.
No, you don't have to do that, and you should not do that.
You should always strive (within reasonable limits of course) to minimise the amount of data that you fetch from the database. Any data that you can elliminate in this step is data that the database doesn't have to handle and data that your application doesn't have to handle.
Just use a query like the one duncanmhor showed in the stored procedure. It will return a result with only the rows that you are interrested in.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
You can build the query in your method. It's best practice to use stored procedures though, since building the query in the method opens you up to sql injection attacks.
<br />
String query = String.Format("Select * from yourtable where yourfield like {0}", search criteria);<br />
But please read up on SQL Injection attacks and why you should be using stored procs.
"You're very clever, young man, very clever," said the old lady. "But it's turtles all the way down!"
|
|
|
|
|
Duncanmhor,
sorry for bordering u again bud the problem is i don't know the name of my field. i have only a combobox with the name of tables and a textbox for user input, so the field can be any column in my table. how do i solve it now?
|
|
|
|