Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Mar 30, 2014, 8:57 PM EDT
Rini150 reputationPosted Mar 30, 2014, 9:11 PM EDT
customernumber-float
customer name-nvarchar(255)
customerpinNumber-float
my aspx.cs code is
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Text;
namespace EbenMpbileApp
{
public partial class Ebenmobile : System.Web.UI.Page
{
float dec2DivId;
protected void Page_Load(object sender, EventArgs e)
{
}
public override void VerifyRenderingInServerForm(Control control)
{
/* Verifies that the control is rendered */
}
protected void btndownload_Click(object sender, EventArgs e)
{
if (ddllist.SelectedIndex == 1)
{
if (TextBox1.Text != string.Empty)
{
dec2DivId = float.Parse(TextBox1.Text);
EbenSp spmobile = new EbenSp();
DataTable dtblc = new DataTable();
dtblc =spmobile.pinNumberSearch(dec2DivId));
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=PinnumberSearch.csv");
Response.Charset = "";
Response.ContentType = "application/text";
StringBuilder sb = new StringBuilder();
for (int k = 0; k < dtblc.Columns.Count; k++)
{
sb.Append(dtblc.Columns[k].ColumnName + ',');
}
//append new line
sb.Append("\r\n");
for (int i = 0; i < dtblc.Rows.Count; i++)
{
for (int k = 0; k < dtblc.Columns.Count; k++)
{
sb.Append(dtblc.Rows[i][k].ToString().Replace(",", ";") + ',');
}
//append new line
sb.Append("\r\n");
}
Response.Output.Write(sb.ToString());
Response.Flush();
Response.End();
}
}
}
}
}
Abhay ShankerRank #375 · 6.7K reputationPosted Mar 30, 2014, 9:13 PM EDT
So cross check in sqlserver t able that the column having data type is decimal and you want to save a varchar value or vice-versa.
if you could share the more details like Table structure and SP then we could point out exactly
Abhay ShankerRank #375 · 6.7K reputationPosted Mar 30, 2014, 9:17 PM EDT
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Mar 30, 2014, 9:19 PM EDT
Rini150 reputationPosted Mar 30, 2014, 9:41 PM EDT