Help
-
I have a text document containing some records Lets say there exists two rows and two columns Among the two columns, one is the email ID Now what i have to do is, To collect the info and place it in a HTML file and i have to send an email to the specified mailId with some subject How can i accomplish this Can any one help me Thanks in advance, :)
-
I have a text document containing some records Lets say there exists two rows and two columns Among the two columns, one is the email ID Now what i have to do is, To collect the info and place it in a HTML file and i have to send an email to the specified mailId with some subject How can i accomplish this Can any one help me Thanks in advance, :)
I'm assuming your text file's delimited... Just grab the text file data using a FileStream object, and parse it into a string array. You can either read it line by line, or grab the whole thing, separate by \n\r, and then parse the fields as you go. I think there's a way to actually use a CSV as a datasource too... May be wrong on that one... It's been a long time since I've mailed anyone through code, so someone else'll have to give you tips on that one. Access the text file using the FileStream object will get you started...
-
I have a text document containing some records Lets say there exists two rows and two columns Among the two columns, one is the email ID Now what i have to do is, To collect the info and place it in a HTML file and i have to send an email to the specified mailId with some subject How can i accomplish this Can any one help me Thanks in advance, :)
Hi there, In addition to using the classes defined in the
System.IO
namespace to access the text .txt file, you can also use ADO.NET to treat your text file as a datasource like Access, SQL .... The sample code can be simple like this:try
{
string conStr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\TextDBFolder\;
Extended Properties=""text;HDR=No;FMT=Delimited""";
OleDbConnection con = new OleDbConnection(conStr);
OleDbDataAdapter adapter = new OleDbDataAdapter("Select * from TextDB.txt", con);
DataSet ds = new DataSet();
adapter.Fill(ds, "TextDB");
}
catch(OleDbException ex)
{
Console.Out.WriteLine(ex.Message);
}For more information, you can see Accessing Data with ADO.NET[^]