Click here to Skip to main content
15,914,066 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to get client IP Pin
Luis Alonso Ramos11-Jul-05 5:16
Luis Alonso Ramos11-Jul-05 5:16 
Generalport Pin
amin saffari7-Jul-05 16:53
amin saffari7-Jul-05 16:53 
GeneralRe: port Pin
Christian Graus7-Jul-05 18:31
protectorChristian Graus7-Jul-05 18:31 
GeneralRe: port Pin
User 66587-Jul-05 21:04
User 66587-Jul-05 21:04 
GeneralRe: port Pin
Dave Kreskowiak8-Jul-05 4:05
mveDave Kreskowiak8-Jul-05 4:05 
Generalxls reading into an array Pin
amitmohanty7-Jul-05 15:57
amitmohanty7-Jul-05 15:57 
GeneralModify application pooling of COM+ component Pin
Johny Ng7-Jul-05 15:56
Johny Ng7-Jul-05 15:56 
GeneralSave Button Pin
tatchung7-Jul-05 15:20
tatchung7-Jul-05 15:20 
Hi! Im creating a form in which i retrieve data from a database and attach it to a grid. I need to have a function in which if i click the save button the results of the retrieved data will be saved as a "text" file. cane someone please tell me what's wrong with my code bcoz whenever i click my save button it doesn't save at all. here's my code:

private void btnSave_Click(object sender, System.EventArgs e)
{
OdbcConnection cnn = new OdbcConnection();

cnn.Open();

OdbcCommand cmmd = new OdbcCommand();
OdbcDataAdapter adp = new OdbcDataAdapter (cmmd);
DataSet ds_emp = new DataSet();
adp.Fill(ds_emp);

System.Text.StringBuilder sb = new System.Text.StringBuilder();

for(int i=0;i<=ds_emp.Rows.Count - 1; i++)
{
for(int q=0;q<=ds_emp.Columns.Count - 1; q++)
{
sb.Append(ds_emp.Rows[i][q].ToString());
}
sb.Append("
");
}
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=*.txt");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.text";
System.IO.StringWriter strWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(strWrite);
Response.Write(sb.ToString());
}

where ds_emp is the retrived data. Is there something wrong with my code? It builds but it doesn't work. Thanx for all your replies! I appreciate it




thanx
GeneralTimeOut exception with HttpWebRequest.getResponse but not with IE Pin
Jason Manfield7-Jul-05 10:48
Jason Manfield7-Jul-05 10:48 
GeneralRe: TimeOut exception with HttpWebRequest.getResponse but not with IE Pin
squawk7-Jul-05 16:36
squawk7-Jul-05 16:36 
GeneralRe: TimeOut exception with HttpWebRequest.getResponse but not with IE Pin
Dave Kreskowiak8-Jul-05 4:00
mveDave Kreskowiak8-Jul-05 4:00 
GeneralRe: TimeOut exception with HttpWebRequest.getResponse but not with IE Pin
squawk11-Jul-05 18:02
squawk11-Jul-05 18:02 
GeneralRe: TimeOut exception with HttpWebRequest.getResponse but not with IE Pin
Dave Kreskowiak12-Jul-05 1:05
mveDave Kreskowiak12-Jul-05 1:05 
Generalcrystal report pictures Pin
kornstyle7-Jul-05 8:50
kornstyle7-Jul-05 8:50 
GeneralGlobally intercepting keyboard events and blocking them if required Pin
Florian Albrechtskirchinger7-Jul-05 8:39
Florian Albrechtskirchinger7-Jul-05 8:39 
GeneralRe: Globally intercepting keyboard events and blocking them if required Pin
Dave Kreskowiak7-Jul-05 9:54
mveDave Kreskowiak7-Jul-05 9:54 
GeneralRe: Globally intercepting keyboard events and blocking them if required Pin
Florian Albrechtskirchinger8-Jul-05 2:57
Florian Albrechtskirchinger8-Jul-05 2:57 
GeneralRe: Globally intercepting keyboard events and blocking them if required Pin
Dave Kreskowiak8-Jul-05 3:55
mveDave Kreskowiak8-Jul-05 3:55 
GeneralRe: Globally intercepting keyboard events and blocking them if required Pin
Florian Albrechtskirchinger9-Jul-05 4:30
Florian Albrechtskirchinger9-Jul-05 4:30 
GeneralRe: Globally intercepting keyboard events and blocking them if required Pin
Florian Albrechtskirchinger13-Jul-05 7:43
Florian Albrechtskirchinger13-Jul-05 7:43 
QuestionTimeSpans as Int's? Pin
YawgmothIII7-Jul-05 5:48
YawgmothIII7-Jul-05 5:48 
AnswerRe: TimeSpans as Int's? Pin
leppie7-Jul-05 6:00
leppie7-Jul-05 6:00 
QuestionIs Someone aware of this Error? Pin
just4ulove77-Jul-05 5:45
just4ulove77-Jul-05 5:45 
AnswerRe: Is Someone aware of this Error? Pin
Alomgir Miah7-Jul-05 5:57
Alomgir Miah7-Jul-05 5:57 
GeneralRe: Is Someone aware of this Error? Pin
just4ulove77-Jul-05 7:48
just4ulove77-Jul-05 7:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.