freelanceprogrammers.org Forum Index » ASP
DataGrid to Text(Nirmal) : Help me Sir
Joined: 25 Jan 2005
Posts: 12
DataGrid to Text(Nirmal) : Help me Sir
Help Me Sir :
The Given Coding :
public void Bind1()
{
SqlConnection sqlConnection = new
SqlConnection("database=Payrull;server=sj2005;uid=sa;pwd=;");
sqlConnection.Open();
SqlDataAdapter ada = new SqlDataAdapter("SELECT Emp_no,Emp_name,F_Name
from Paymast",sqlConnection);
ds = new DataSet();
ada.Fill(ds);
rec.DataSource = ds.Tables[0] ;
rec.DataBind();
{
StringBuilder str = new StringBuilder();
for(int i=0;i<=ds.Tables[0].Rows.Count - 1; i++)
{
for(int j=0;j<=ds.Tables[0].Columns.Count - 1; j++)
{
str.Append(ds.Tables[0].Rows[i][j].ToString());
str.Append(char.ToString(` `));
str.Append(char.ToString(` `));
}
str.Append(Environment.NewLine);
}
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.txt");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.text";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
rec.RenderControl(htmlWrite);
Response.Write(str.ToString());
Response.End();
}
}
The Output :
The Ouput is in Irregular Format
1 Michael Benjamin
10 Samuel Arumainayagam K.
11 Pratheep B.
11013 Jeyachandran P. Peter Chelliah Y.
11024 Palani Kumar N. Natarajan
11035 Selvakumar Samuel A. Aron Durai Pandian
11046 Jeyaraj J. Joseph
11057 Chandrasekaran S. Sankaralingam
11068 Asir Gnanadoss T. Thiagaraj
11079 Rajendra Prasad S. Sonachalam
11081 Alphonse D. SMN Fernando
11092 Latha K. Kaisinth S.
11103 Balasubramaniam G. Ganapathy
11114 Vedanayagam P. Paramasivan
11125 Jeyakumar Thanasing P. Paulraj Abraham
11136 Immanuel K.Jeyaprakash Koilpillai
11147 Thangaraj R. Rajamany D.
11158 Selvadurai P.M. Pandiyaraj
11169 Suriyan S. Subramonian
11171 Rajendran S. Sathiamurthy
11182 Jessy Devi G. Gerald P. Rayen
11193 Meenatchi Sundaram V. Veerabahu
11204 Subbiah M. Muthiah
Sir the Output not in Proper Manner . I Have to arrange in the table form.
But not the table.
Example : I want the Output Like this
101 Nirmal. Manuel.
102 Sundaram. Arun.
103 Zion.
10411 Arun.
In this Format I want Sir. Please Help me Sir.
---------------------------------
Yahoo! India Matrimony: Find your partner now.
[Non-text portions of this message have been removed]
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







