Click here to Skip to main content
15,398,348 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 9:11
MemberSteven Petersen3-Apr-22 9:11 
AnswerRe: MVC 5 Prevent Users From Going Back After Logging In or Out Using Identity Framework Pin
Richard Deeming3-Apr-22 21:24
mveRichard Deeming3-Apr-22 21:24 
QuestionA question about CreatedAtAction() method Pin
Alex Dunlop23-Mar-22 21:44
MemberAlex Dunlop23-Mar-22 21:44 
AnswerRe: A question about CreatedAtAction() method Pin
Richard MacCutchan23-Mar-22 21:50
mveRichard MacCutchan23-Mar-22 21:50 
QuestionA question about routing attribute Pin
Alex Dunlop23-Mar-22 21:41
MemberAlex Dunlop23-Mar-22 21:41 
AnswerRe: A question about routing attribute Pin
Richard MacCutchan23-Mar-22 21:51
mveRichard MacCutchan23-Mar-22 21:51 
GeneralRe: A question about routing attribute Pin
Leeladhar Ladia25-Mar-22 3:46
MemberLeeladhar Ladia25-Mar-22 3:46 
Questionexportar datos de sql server a archivo .csv con C# asp.net Pin
Member 1556240011-Mar-22 8:08
MemberMember 1556240011-Mar-22 8: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 17:21
MemberMember 155547063-Mar-22 17:21 
Rant[REPOST] Power BI Embedded : Cant doCross Filtering selecting multiple rows on a table visual pressing CTRL Pin
Richard Deeming3-Mar-22 21:30
mveRichard Deeming3-Mar-22 21:30 
AnswerRe: Power BI Embedded : Cant doCross Filtering selecting multiple rows on a table visual pressing CTRL Pin
RedDk4-Mar-22 7:01
MemberRedDk4-Mar-22 7:01 
QuestionASP .Net Core, Global HTML sanitization. Pin
GKP199228-Feb-22 17:46
professionalGKP199228-Feb-22 17:46 
AnswerRe: ASP .Net Core, Global HTML sanitization. Pin
Richard Deeming28-Feb-22 21:50
mveRichard Deeming28-Feb-22 21:50 
GeneralRe: ASP .Net Core, Global HTML sanitization. Pin
GKP199228-Feb-22 23:44
professionalGKP199228-Feb-22 23:44 
QuestionASP.NetCore Freeze the header of html table Pin
pkfox22-Feb-22 21:29
professionalpkfox22-Feb-22 21:29 
AnswerRe: ASP.NetCore Freeze the header of html table Pin
Richard Deeming24-Feb-22 0:32
mveRichard Deeming24-Feb-22 0:32 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
pkfox24-Feb-22 2:09
professionalpkfox24-Feb-22 2:09 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
Richard Deeming24-Feb-22 21:33
mveRichard Deeming24-Feb-22 21:33 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
pkfox24-Feb-22 21:56
professionalpkfox24-Feb-22 21:56 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
Richard Deeming24-Feb-22 22:37
mveRichard Deeming24-Feb-22 22:37 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
pkfox24-Feb-22 23:14
professionalpkfox24-Feb-22 23:14 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
Richard Deeming24-Feb-22 23:23
mveRichard Deeming24-Feb-22 23:23 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
pkfox24-Feb-22 23:35
professionalpkfox24-Feb-22 23:35 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
Richard Deeming24-Feb-22 23:52
mveRichard Deeming24-Feb-22 23:52 
GeneralRe: ASP.NetCore Freeze the header of html table Pin
pkfox25-Feb-22 2:31
professionalpkfox25-Feb-22 2: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.