Problem ou erreur de requetes Sql
Bonjour les Devs ,
Je desire récuperer des data afin de les insérer dans un rapport xls, mais je pense avoir fait une erreur au niveau de ma requetes , car lors du debuggage , je remarque que mon id est null
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| protected void Page_Load(object sender, EventArgs e)
{
FileStream fs = new FileStream(Server.MapPath(@"~\template\ClientR.xls"), FileMode.Open, FileAccess.Read);
HSSFWorkbook templateWorkbook = new HSSFWorkbook(fs, true);
HSSFSheet sheet = templateWorkbook.GetSheet("Event Budget");
String sql = "SELECT CLIENT.NAME FROM CLIENT where CLIENT.ID='1925' ";
string str = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["BGEConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(str);
SqlCommand comm = new SqlCommand(sql, conn);
conn.Open();
SqlDataReader nwReader = comm.ExecuteReader();
int row = 7;
while (nwReader.Read())
{
string UserID = nwReader["NAME"].ToString();
// Do something with UserID here...
sheet.GetRow(row).GetCell(1).SetCellValue(UserID);
}
nwReader.Close();
conn.Close();
sheet.ForceFormulaRecalculation = true;
MemoryStream ms = new MemoryStream();
templateWorkbook.Write(ms);
ExportDataTableToExcel(ms, "EventExpenseReport.xls");
} |
Es ce que je me suis tromper ici ?
Code:
String sql = "SELECT CLIENT.NAME FROM CLIENT where CLIENT.ID='1925' ";
Merci en avance