|
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Maybe you have to use a foreach loop and different threads to upload the stuff...
foreach(string file in Directory.GetFiles("C:\Temp\FtpUpload"))
{
FTPClass.UploadFile(file);
}
|
|
|
|
|
I have developed master-detail relationship in two grids, but i want in one grid. Is it possible or not in windows Application?
|
|
|
|
|
Mis$Fit wrote: Is it possible or not in windows Application?
It's possible.
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
|
You'll either have to use a 3rd party grid control that supports it or develop you're own (not easy!). The DatGridView doesn't support it.
|
|
|
|
|
As I recall you can have drill-down functionality in a DataGridView, but I haven't tried that since 2005.
You probably don't want any grids at all. Grids are horrible.
If you are just presenting readonly data I recommend a TreeView for hierarchical data.
What is it you are trying to do?
|
|
|
|
|
I'm sure I saw there was a documentation regarding to enum usage.
I'm creating a game children that would involve a person that have enums of face, body, legs, feet, arms, hands. Each of those parts have unique values (i.e. face would have values of "round", "square", "oval").
I'm not quite sure on how to put those enums into "person" object.
Can anyone point out the documentation? Thanks!
(or should I use struct? or the other way?)
modified 16-Dec-12 22:23pm.
|
|
|
|
|
Something along the lines of:
public enum FaceType { Round , ... }
public enum FootType { Hairy , ... }
public class Person
{
public FaceType Face { get ; private set ; }
public FootType LeftFoot { get ; private set ; }
public FootType RightFoot { get ; private set ; }
...
}
might work, but I'm unsure it would be best -- for one thing adding new attributes, like new face types, might be more difficult than necessary.
You might consider have a config file or a database to store the types and values.
|
|
|
|
|
ahh I'll give that a shot! thanks!
|
|
|
|
|
Hi,
I want to ask about MySqlParameter, when to use Add and when to use AddWithValue? because both seems to be working in every case I tried..
Technology News @ www.JassimRahma.com
|
|
|
|
|
There is no difference in the end result, AddWithValue just shortens the parameter creation process. Use the one you are comfortable with.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You can use whichever you want, but I always use Add because IDataParameterCollection doesn't include AddWithValue .
|
|
|
|
|
use AddWithValue!
beacuse use a strongly type dataset functionality
|
|
|
|
|
Hi,
Maby this is simple for you, but for me is not.
I have this code:
int rezultat = 0;
try
{
if (sqlconn.State != ConnectionState.Open)
{
sqlconn.Open();
}
rezultat = (int)cmd.ExecuteScalar();
}
catch (Exception ex)
{
lblMesaje.Text = "Eroare: " + ex.Message.ToString();
}
finally
{
if (sqlconn.State != ConnectionState.Closed)
{
sqlconn.Close();
}
}
return rezultat;
Is just for inserting a new record in a table. Even if this throw an error "Specified cast is not valid." "rezultat=(int)cmd.ExecuteScalar();" - the code is executed and the row is inserted in the database, and the execution continues.
Why it continues?
Maby i don't understand the try catch finally yet
Thank you!
|
|
|
|
|
The whole idea of try...catch blocks is to do exactly what you have done: catch an error, report it (or log it, or fix it) and let the software continue without crashing.
In your case, the exception is being thrown because the result returned by SQL is not an integer, and cannot be cast to an integer (it may be a DBNull, or a string for example - either put a breakpoint on the ExecuteScalar line and look at the return, or include the return value in your message to actually fix the problem). But the insert has been done by that time, so the row is in the DB already.
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
Thank you for your message!
Beceause now i try to learn some C# programming (and write in english), your message help me to understand about Try catch.
Just to be sure that i have understand:
1. I have my btnSave code that look like this:
protected void btnSave_Click(object sender, EventArgs e)
{
try
{
int x = 0;
x = SaveData();
if (x > 0)
{
lblMesaje.Text = " Your new ID is: " + x.ToString();
}
}
catch (Exception ex)
{
lblMesage.Text = "Some error occured: " + ex.Message;
}
}
2. Now here is my Insert function:
private int SaveData()
{
//SQL objects set..
int result= 0;
try
{
if (sqlconn.State != ConnectionState.Open)
{
sqlconn.Open();
}
result= Convert.ToInt32(cmd.ExecuteScalar());
return result;
}
catch (Exception)
{
throw;
}
finally
{
if (sqlconn.State != ConnectionState.Closed)
{
sqlconn.Close();
}
}
}
Now i throw and exception in SaveData function and the message is displayed to the user. Is ok?
Thanks again!
|
|
|
|
|
Looks good!
If you get an email telling you that you can catch Swine Flu from tinned pork then just delete it. It's Spam.
|
|
|
|
|
This is fine, although the
Claudiu Schiopu wrote: catch (Exception)
{
throw;
}
doesn't really do much. You can just have the
try and
finally blocks, and the code would effectively do the same thing.
The shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
How do i run powershell script from c# button
i want to run as example simple powershell command
for example : Get-WmiObject Win32_ComputerSystem | Select name, in textbox
|
|
|
|
|
You probably need to use the Process.Start() [^] method.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi Richard, Just thought you might like to know that there's an article on CP which does this in a better way than Process.Start - see my comment below for a link. When I last did it, the method described seemed to work better than Process.Start so might be worth knowing about if you ever need to do this.
|
|
|
|
|
Thanks, looks like a very useful link. I guess I should really have remembered
this as I have done a bit of reading about PowerShell in the past.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
|
right now i'm having a c# tcp server that collect the data from different sites and insert it in to database and a web application that show data. What i want is to bind them in to one single web application.if it is possible please give me some ideas.
|
|
|
|