|
let me understand u, that i can recieve attachment from other emails but not attachment from this code.
I am using MailMessage
[code]
MailMessage m=new MailMessage();
....
m.Attachments.Add(new Attachment(filePath));
SmtpClient sC=new SmtpClient(HOST,PORT);
sC.send(from,to,subject,body);
[/code]
the file which i am attaching is simply txt file, and for sure i would like to upload different files as doc,pdf,xls,jpg,png and others.
Thanks
Abdul Rahaman Hamidy
Senior Student Student in Computer Science
Kabul, Afghanistan
Software Developer
|
|
|
|
|
Have you set breakpoints in your code and verified that the attachment is actually getting created and added to the collection properly?
Also, your code
SmtpClient sC=new SmtpClient(HOST,PORT);
sC.send(from,to,subject,body); doesn't appear to actually send the MailMessage you created.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Thanks for reply, indeed it works if i use the method smtpClient.send(MailMessage m).
but it does not work with smtpClient.send(from,to,subject,body) method.
Thanks a lot, I did it,
I really appreciate your cooperation.
Abdul Rahaman Hamidy
Senior Student Student in Computer Science
Kabul, Afghanistan
Software Developer
|
|
|
|
|
Hi All,
I am new to C# programming with ADO.NET. I tried to delete the specific row but it is not getting affected in the database table. however when i wrote to a XML file, the record seems to be deleted.
SqlDataAdapter da = new SqlDataAdapter("select * from details", con);
DataSet ds = new DataSet();
da.Fill(ds, "details");
DataRow row = ds.Tables["details"].Rows[0];
if (row["Name"].ToString() == fi.Name)
{
ds.Tables["details"].Rows[0].Delete();
da.Update(ds.Tables["details"]);
}
ds.AcceptChanges();
Can any one help me out with an example(C#) for better understanding.
Thanks in advance..
Suresh.
|
|
|
|
|
|
Hi,
It seems to be you are trying to delete First Row (Rows[0]), Which you don't want. You have to get specific object of that row and then use Delete command. After that you can update by useing DataAdapter to make permenent delete underling Database. Here is a code which might Help.
foreach (Datarow dr in ds.tables[Customer].rows)
{
Dr.delete();
break;
}
da.update(ds);
Hope it will help
Thanks
Ali Zishan
London
|
|
|
|
|
Hi,
Thanks a lot!!! It's working.
Thanks once again,
Suresh kumar palleti,
India.
|
|
|
|
|
I'm try to writing a program use to allow The Phone like a game-handle.
How can I connect PC and WindowsMobile Phone use bluetooth?
Thanks!
|
|
|
|
|
|
Hi
Can anyone please tell me how to restrict the browser to a sigle tab,and prevent the user from opening any new tabs in the same browser.
Is it possible to achieve this from javascript or on the server side ?
Thanks in advance
|
|
|
|
|
Nope. It's not possible to restrict IE7 to a single tab from code running in the browser and definitly not possible to do it from the server side. It IS a setting available to the user of IE7, but changing that setting requires IE7 to be restarted in order for it to take effect.
|
|
|
|
|
Hi Dave,
Thanks for your response i got the point.
My problem is that when the application is opened in multiple tabs in the same browser
it is using the same session id.
Making the session cookieless using the sessionstate attribute in web.config does solve my problem
but the following link
http://msdn.microsoft.com/en-us/library/h6bb9cz9.aspx[^]
says that it is not advisable for ajax enabled applications
what maybe the reason for that or do i have any other work arounds to avoid the browser using the
same sessionid across multiple tabs.
Thanks,
R.Sundar.
|
|
|
|
|
I have no idea since my experience with AJAX is really limited. You should be asking this in the ASP.NET forum, not C#.
|
|
|
|
|
hello,
I have a datatable with 4 columns
now i have some value in cell of 4th column
and on selectedIndexchange event of Combobox i want to update its value.
i m looping below listed code:
<code>MarkupList.Rows[i].ItemArray.SetValue("For Information Only", 4);</code>
but it does'nt seem to work as it is not changing value.
please help to solve the problem.
sejal
|
|
|
|
|
Hi Sejal,
Can you please post your code here ,so one can provide the solution ?
Regards
|
|
|
|
|
for (int i = 0; MarkupList.Rows.Count; i++)
{
if (MarkupList.Rows[i].ItemArray.GetValue(4) == "No")
{
MarkupList.Rows[i].ItemArray.SetValue("ENG_NO", 4);
}
else if (MarkupList.Rows[i].ItemArray.GetValue(4) == "None")
{
MarkupList.Rows[i].ItemArray.SetValue("Eng_NONE", 4);
}
else if (MarkupList.Rows[i].ItemArray.GetValue(4) == "Yes")
{
MarkupList.Rows[i].ItemArray.SetValue("ENG_YES", 4);
}
}
May be this is not correct. But i wanted to know the method to update datatable field values.
sejal
|
|
|
|
|
How do i declare array inside a struct.Cause i got error, and it said should use new keyword to declare. For example:
public struct MY_TRUCT
{
public int Number;
public string Description;
public string ParaTypes[20];
}
|
|
|
|
|
may be like this
public struct MY_TRUCT
{
public int Number;
public string Description;
public string[] ParaTypes = new string[20];
}
rahul
|
|
|
|
|
No, that doesn't work. You can't initialize the members of a struct.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
You can't create an array in the declaration of a struct.
Do you have any reason to make it a struct? Otherwise you should make it a class. Implementing a struct correctly is more complicated than implementing a class correctly.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
As it was said, you cannot initialize struct member, neither can you use parameterless constructor,
but you can use a constructor with parameters and initialize you array there.
Something like this:
public struct MY_TRUCT
{
public int Number;
public string Description;
public string ParaTypes[];
public MY_TRUCT(string[] paraTypes) {
ParaTypes = paraTypes;
}
}
Regards,
Lev
modified on Tuesday, December 30, 2008 1:06 AM
|
|
|
|
|
With some corrections, that would work, but it still isn't a good implementation of a struct.
Consider this:
MY_TRUCT x = new MY_TRUCT(new string[] { "a", "b" } );
Console.WriteLine(x.ParaTypes[0]);
MY_TRUCT y = x;
y.ParaTypes[0] = "c";
Console.WriteLine(x.ParaTypes[0]);
Mutable structs can give you surprising results, structs containing mutable objects can give you even more surprising results...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: With some corrections, that would work, but it still isn't a good implementation of a struct.
Nobody says it is
I just wanted to make a point that he can initialize a struct member with a constructor with parameters, if a non-default value is needed.
Regards,
Lev
|
|
|
|
|
public string ParaTypes[20]
i got error: array size can not be specified in a variable declaration?
|
|
|
|