I am using SMS caster to send sms.It has an option to Import csv files.
Now I want to dynamically create csv file of CellNo column of Person table from Visual Studio 2010 connected SQL Server 2008.So that I click on a button and it creates a csv file which I can then access from my software SMSCaster to send sms.
The solutions available are either manual-based or if some query is provided it requires Microsoft OLEDB.....so is there any simple query to convert queryresult into .csv file?
Try this :
Namespace : System.IO;
var _lines = new List<string>();
for(int _i=0;i<gridview1.rows.count;_i++)
{
string[] _mobileNos = gridView1.rows[_i].cells[mobilecolumn index in gridview].text;
var header = string.Join(",", _mobileNos);
_lines.Add(header);
}
File.WriteAllLines("FileName.csv",_lines);