Click here to Skip to main content
15,799,019 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionMVC 5 Prevent Users From Going Back After Logging In or Out Using Identity Framework Pin
Steven Petersen3-Apr-22 10:11
Steven Petersen3-Apr-22 10:11 
AnswerRe: MVC 5 Prevent Users From Going Back After Logging In or Out Using Identity Framework Pin
Richard Deeming3-Apr-22 22:24
mveRichard Deeming3-Apr-22 22:24 
QuestionA question about CreatedAtAction() method Pin
Alex Dunlop23-Mar-22 22:44
Alex Dunlop23-Mar-22 22:44 
AnswerRe: A question about CreatedAtAction() method Pin
Richard MacCutchan23-Mar-22 22:50
mveRichard MacCutchan23-Mar-22 22:50 
QuestionA question about routing attribute Pin
Alex Dunlop23-Mar-22 22:41
Alex Dunlop23-Mar-22 22:41 
AnswerRe: A question about routing attribute Pin
Richard MacCutchan23-Mar-22 22:51
mveRichard MacCutchan23-Mar-22 22:51 
GeneralRe: A question about routing attribute Pin
Leeladhar Ladia25-Mar-22 4:46
Leeladhar Ladia25-Mar-22 4:46 
Questionexportar datos de sql server a archivo .csv con C# asp.net Pin
Member 1556240011-Mar-22 9:08
Member 1556240011-Mar-22 9:08 
Hello group, a question please. The data from my databases all come out in a single string per row in the .csv file, how can I print it in a cell per field in the .csv file? I attach images and code for more clarity with the problem. Thanks


<pre lang="C#">
public partial class CS : System.Web.UI.Page {
protected void ExportCSV(object sender, EventArgs e)
{
string constr = ConfigurationManager.ConnectionStrings["PRUEBASConnectionString"].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand("SELECT * FROM Customers"))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);

//Build the CSV file data as a Comma separated string.
string csv = string.Empty;

foreach (DataColumn column in dt.Columns)
{
//Add the Header row for CSV file.
csv += column.ColumnName + ',';
}

//Add new line.
csv += "\r\n";

foreach (DataRow row in dt.Rows)
{
foreach (DataColumn column in dt.Columns)
{
//Add the Data rows.
csv += row[column.ColumnName].ToString().Replace(",", ";") + ',';
}

//Add new line.
csv += "\r\n";
}

//Download the CSV file.
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=SqlExport.csv");
Response.Charset = "";
Response.ContentType = "application/text";
Response.Output.Write(csv);
Response.Flush();
Response.End();
}
}
}
}
} }
QuestionPower BI Embedded : Cant doCross Filtering selecting multiple rows on a table visual pressing CTRL Pin
Member 155547063-Mar-22 18:21
Member 155547063-Mar-22 18:21 
Rant[REPOST] Power BI Embedded : Cant doCross Filtering selecting multiple rows on a table visual pressing CTRL Pin
Richard Deeming3-Mar-22 22:30
mveRichard Deeming3-Mar-22 22:30 
AnswerRe: Power BI Embedded : Cant doCross Filtering selecting multiple rows on a table visual pressing CTRL Pin
RedDk4-Mar-22 8:01
RedDk4-Mar-22 8:01 
QuestionASP .Net Core, Global HTML sanitization. Pin
GKP199228-Feb-22 18:46
professionalGKP199228-Feb-22 18:46 
AnswerRe: ASP .Net Core, Global HTML sanitization. Pin
Richard Deeming28-Feb-22 22:50
mveRichard Deeming28-Feb-22 22:50 
GeneralRe: ASP .Net Core, Global HTML sanitization. Pin
GKP19921-Mar-22 0:44
professionalGKP19921-Mar-22 0:44 
QuestionASP.NetCore Freeze the header of html table Pin
pkfox22-Feb-22 22:29
professionalpkfox22-Feb-22 22:29 
AnswerRe: ASP.NetCore Freeze the header of html table Pin
Richard Deeming24-Feb-22 1:32
mveRichard Deeming24-Feb-22 1:32 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
pkfox24-Feb-22 3:09
professionalpkfox24-Feb-22 3:09 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
Richard Deeming24-Feb-22 22:33
mveRichard Deeming24-Feb-22 22:33 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
pkfox24-Feb-22 22:56
professionalpkfox24-Feb-22 22:56 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
Richard Deeming24-Feb-22 23:37
mveRichard Deeming24-Feb-22 23:37 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
pkfox25-Feb-22 0:14
professionalpkfox25-Feb-22 0:14 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
Richard Deeming25-Feb-22 0:23
mveRichard Deeming25-Feb-22 0:23 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
pkfox25-Feb-22 0:35
professionalpkfox25-Feb-22 0:35 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
Richard Deeming25-Feb-22 0:52
mveRichard Deeming25-Feb-22 0:52 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
pkfox25-Feb-22 3:31
professionalpkfox25-Feb-22 3:31 

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.