Click here to Skip to main content
15,917,618 members

Comments by ketfos1 (Top 3 by date)

ketfos1 8-Nov-12 8:59am View    
-- removed by digimanus and set in question
ketfos1 30-Oct-12 1:34am View    
Here is the code and error is " The name gvFiles do not exist in the current context".
I am getting this error while I render grid control statement.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;
using System.IO;
using System.Data.SqlClient;

namespace Oracleconnect1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}




string test1 = "Data Source=test;User Id=test;Password=test123;"; // C#
private void button1_Click(object sender, EventArgs e)
{

OracleConnection conn = new OracleConnection(test1);
{ conn.Open();
label1.Text = conn.State.ToString();
OracleCommand oc = conn.CreateCommand();
oc.CommandText = "SELECT * FROM county where rownum < 10 and policy_year =" + textBox1.Text ;
OracleDataReader reader = oc.ExecuteReader();
bindingSource1.DataSource = reader;
dataGridView1.DataSource = bindingSource1;
dataGridView1.BorderStyle = BorderStyle.Fixed3D;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
}

}

private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{

}

private void button2_Click(object sender, EventArgs e)
{
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
// Render grid view control.
gvFiles.RenderControl(htw);
// Write the rendered removed to a file.
string renderedGridView = sw.ToString();
File.WriteAllText(@"C:\temp\ExportedFile.xlsx", renderedGridView);
}
ketfos1 29-Oct-12 23:25pm View    
I have added this code in the button click and I am getting error message
"The name Response does not exist in current context"
"The name GridView doesnot exisit in current context"