Click here to Skip to main content
15,902,634 members
Home / Discussions / ASP.NET
   

ASP.NET

 
SuggestionRe: asp.net Emergency Assistance Pin
Thanks787226-Jun-14 23:47
professionalThanks787226-Jun-14 23:47 
Questionasp.net Emergency Assistance Pin
ozanadiaa26-Jun-14 2:12
ozanadiaa26-Jun-14 2:12 
AnswerRe: asp.net Emergency Assistance Pin
Thanks787226-Jun-14 3:00
professionalThanks787226-Jun-14 3:00 
AnswerRe: asp.net Emergency Assistance Pin
thatraja26-Jun-14 3:57
professionalthatraja26-Jun-14 3:57 
RantRe: asp.net Emergency Assistance Pin
Richard Deeming26-Jun-14 4:42
mveRichard Deeming26-Jun-14 4:42 
AnswerRe: asp.net Emergency Assistance Pin
jkirkerx26-Jun-14 11:37
professionaljkirkerx26-Jun-14 11:37 
QuestionOutlook integration with asp.net web application Pin
indukumar12325-Jun-14 20:41
indukumar12325-Jun-14 20:41 
QuestionString or binary data would be truncated Pin
Member 1005230324-Jun-14 22:20
Member 1005230324-Jun-14 22:20 
Hi Friends, plz help me with this error
My Error is :

An exception of type 'System.InvalidOperationException' occurred in System.Data.dll but was not handled in user code

Additional information: The given value of type String from the data source cannot be converted to type nchar of the specified target column.

String or binary data would be truncated.

My Code:

protected void Button1_Click(object sender, EventArgs e)
{
String strConnection = @"Data Source=MANOJ\SQLEXPRESS;Initial Catalog=MANOJ;Integrated Security=True";

string path = @"C:\Users\Manoj Kumar\Desktop\Update Folder\TESTING.xlsx";
//Create connection string to Excel work book
string excelConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=1\"";
//Create Connection to Excel work book
OleDbConnection excelConnection = new OleDbConnection(excelConnectionString);
OleDbCommand cmd = new OleDbCommand("select *from [Sheet1$]", excelConnection);
excelConnection.Open();
OleDbDataReader dReader;
dReader = cmd.ExecuteReader();
SqlBulkCopy sqlBulk = new SqlBulkCopy(strConnection);
//Give your Destination table name
sqlBulk.DestinationTableName = "TEST";
sqlBulk.WriteToServer(dReader); // Here i getting the above error
excelConnection.Close();
Response.Write("inserted");
}

----- Same code is running Fine when i working on VS 2010 and SQL 2005

Now i use VS 2013 and SQL 2012 Then i getting the error.

PLZ give me the error free code.
AnswerRe: String or binary data would be truncated Pin
Richard Deeming25-Jun-14 1:38
mveRichard Deeming25-Jun-14 1:38 
AnswerRe: String or binary data would be truncated Pin
Praveen Dselva24-Jul-14 0:15
professionalPraveen Dselva24-Jul-14 0:15 
QuestionMessage Closed Pin
23-Jun-14 21:32
ozanadiaa23-Jun-14 21:32 
QuestionHandle Bad characters Pin
slSoftware23-Jun-14 19:23
slSoftware23-Jun-14 19:23 
AnswerRe: Handle Bad characters Pin
jkirkerx24-Jun-14 8:20
professionaljkirkerx24-Jun-14 8:20 
QuestionTwo ASP.Net Web API quesitons? Pin
JMK-NI23-Jun-14 7:33
professionalJMK-NI23-Jun-14 7:33 
AnswerRe: Two ASP.Net Web API quesitons? Pin
Kornfeld Eliyahu Peter23-Jun-14 9:35
professionalKornfeld Eliyahu Peter23-Jun-14 9:35 
GeneralRe: Two ASP.Net Web API quesitons? Pin
JMK-NI23-Jun-14 11:13
professionalJMK-NI23-Jun-14 11:13 
QuestionOpen access file inside web browser Pin
Member 1049295822-Jun-14 21:01
Member 1049295822-Jun-14 21:01 
QuestionUsing ViewBag values set in a Controller for conditional logic in the controller's View Pin
Stephen Holdorf22-Jun-14 7:17
Stephen Holdorf22-Jun-14 7:17 
AnswerRe: Using ViewBag values set in a Controller for conditional logic in the controller's View Pin
Kornfeld Eliyahu Peter23-Jun-14 3:23
professionalKornfeld Eliyahu Peter23-Jun-14 3:23 
GeneralRe: Using ViewBag values set in a Controller for conditional logic in the controller's View Pin
Stephen Holdorf23-Jun-14 6:13
Stephen Holdorf23-Jun-14 6:13 
AnswerRe: Using ViewBag values set in a Controller for conditional logic in the controller's View Pin
Kornfeld Eliyahu Peter23-Jun-14 6:16
professionalKornfeld Eliyahu Peter23-Jun-14 6:16 
GeneralRe: Using ViewBag values set in a Controller for conditional logic in the controller's View Pin
Stephen Holdorf23-Jun-14 7:08
Stephen Holdorf23-Jun-14 7:08 
AnswerRe: Using ViewBag values set in a Controller for conditional logic in the controller's View Pin
Kornfeld Eliyahu Peter23-Jun-14 7:11
professionalKornfeld Eliyahu Peter23-Jun-14 7:11 
QuestionFormatting problem with Expandalbe .NET Gridview Pin
estreb22-Jun-14 4:21
estreb22-Jun-14 4:21 
AnswerRe: Formatting problem with Expandalbe .NET Gridview Pin
Kornfeld Eliyahu Peter23-Jun-14 2:13
professionalKornfeld Eliyahu Peter23-Jun-14 2:13 

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.