Click here to Skip to main content
15,887,083 members
Home / Discussions / C#
   

C#

 
GeneralRe: Fundamental misunderstanding of structs as "value" types Pin
OriginalGriff28-Sep-18 4:55
mveOriginalGriff28-Sep-18 4:55 
Questionhow to create discussion forum in our asp.net application Pin
Member 1400092528-Sep-18 2:29
Member 1400092528-Sep-18 2:29 
AnswerRe: how to create discussion forum in our asp.net application Pin
Pete O'Hanlon28-Sep-18 3:24
mvePete O'Hanlon28-Sep-18 3:24 
Questionmake a design similar to windows mail in visual studio Pin
erdalczr28-Sep-18 0:46
erdalczr28-Sep-18 0:46 
AnswerRe: make a design similar to windows mail in visual studio Pin
OriginalGriff28-Sep-18 2:35
mveOriginalGriff28-Sep-18 2:35 
GeneralRe: make a design similar to windows mail in visual studio Pin
Richard MacCutchan28-Sep-18 3:29
mveRichard MacCutchan28-Sep-18 3:29 
GeneralRe: make a design similar to windows mail in visual studio Pin
OriginalGriff28-Sep-18 3:54
mveOriginalGriff28-Sep-18 3:54 
QuestionUploading a large Excel file using Entity Framework and Stored Procedure Call Pin
simpledeveloper27-Sep-18 8:40
simpledeveloper27-Sep-18 8:40 
Hi, I am trying to upload an Excel file by passing excel data as User Defined Datatype to a stored Procedure using Entity Framework and C# Code in an ASP.Net Application as below:
public System.Int32 UploadServiceProgram(List<ServicePrograms_Upload> serviceProgList, string Fiscal_Period_Code, string CreatedBy)
{
    DataTable serviceProgramDataTable = new DataTable();
    serviceProgramDataTable.Columns.Add("ServiceCode", typeof(string));
    serviceProgramDataTable.Columns.Add("ProgramCode", typeof(int));
    serviceProgramDataTable.Columns.Add("UnitTypeDesc", typeof(string));
    serviceProgramDataTable.Columns.Add("RateCap", typeof(decimal));
    serviceProgramDataTable.Columns.Add("CountyCode", typeof(string));


    foreach (var item in serviceProgList)
    {
        serviceProgramDataTable.Rows.Add(item.Provided_Service_Code, item.Program_Code, item.Unit_Type, item.Rate_Cap);
    }

    var parameter = new SqlParameter("@ServiceProgram", SqlDbType.Structured);
    parameter.Value = serviceProgramDataTable;
    parameter.TypeName = "dbo.ServicePrograms_UDT";

    var parameter2 = new SqlParameter("@Fiscal_Period_Code", SqlDbType.NVarChar, 15);
    parameter2.Value = Fiscal_Period_Code;

    var parameter3 = new SqlParameter("@CreatedBy", SqlDbType.NVarChar, 50);
    parameter3.Value = CreatedBy;

    using (var context = new CRSContext())
    {
        context.Database.CommandTimeout = 360000;
        var result = context.Database.SqlQuery<int>("usp_Upload_ServicePrograms @ServiceProgram, @Fiscal_Period_Code, @CreatedBy", parameter, parameter2, parameter3).FirstOrDefault();

        return result;
    }
}

It is failing for some reason, but the same Excel file I have exported into a Table, then creating a Table Variable of type (the User Defined Type) that I am using then inserting into that Table variable from the Table that I have Excel data in, then executing the Stored Procedure is not failing actually importing the Data as it is, I am not sure why the Stored Procedure executes but the above method fails, in both the cases Stored Procedure and Excel are the same. Here is how I am executing the Stored Procedure:
declare @ServiceProgram ServicePrograms_UDT
declare @fiscalPeriod nvarchar(15)='FY 2016-2017', @CreatedBy nvarchar(50)='aaleemmo'

insert into @ServiceProgram(ServiceCode, ProgramCode, UnitTypeDesc, RateCap, CountyCode)
select [service code], [Program Code], [Unit Type], [Rate Cap], [County Code] from SUDCRS..zzServiceProgramCountyExcelData

exec dbo.usp_Upload_ServicePrograms @ServiceProgram, @fiscalPeriod, @CreatedBy

And one more doubt I have is, when my WCF Service is posting this huge excel data as datatable to the Database, would it lose the Data when it is posting huge data, if it is losing that, is there any other approach I can execute this stored procedure.
Please let me know anything that's possible, a suggestion, a code snippet or even a tiny suggestion, any thing helps, its little bit urgent - please, thanks a lot.
AnswerRe: Uploading a large Excel file using Entity Framework and Stored Procedure Call Pin
Dave Kreskowiak27-Sep-18 9:50
mveDave Kreskowiak27-Sep-18 9:50 
GeneralRe: Uploading a large Excel file using Entity Framework and Stored Procedure Call Pin
simpledeveloper27-Sep-18 10:11
simpledeveloper27-Sep-18 10:11 
GeneralRe: Uploading a large Excel file using Entity Framework and Stored Procedure Call Pin
Member 140028821-Oct-18 0:10
Member 140028821-Oct-18 0:10 
GeneralRe: Uploading a large Excel file using Entity Framework and Stored Procedure Call Pin
Dave Kreskowiak1-Oct-18 4:20
mveDave Kreskowiak1-Oct-18 4:20 
GeneralRe: Uploading a large Excel file using Entity Framework and Stored Procedure Call Pin
Member 140028821-Oct-18 11:27
Member 140028821-Oct-18 11:27 
GeneralRe: Uploading a large Excel file using Entity Framework and Stored Procedure Call Pin
simpledeveloper1-Oct-18 13:30
simpledeveloper1-Oct-18 13:30 
GeneralRe: Uploading a large Excel file using Entity Framework and Stored Procedure Call Pin
Dave Kreskowiak1-Oct-18 15:52
mveDave Kreskowiak1-Oct-18 15:52 
GeneralRe: Uploading a large Excel file using Entity Framework and Stored Procedure Call Pin
simpledeveloper2-Oct-18 7:58
simpledeveloper2-Oct-18 7:58 
GeneralRe: Uploading a large Excel file using Entity Framework and Stored Procedure Call Pin
Dave Kreskowiak2-Oct-18 10:04
mveDave Kreskowiak2-Oct-18 10:04 
QuestionHow to allow null value inside datetime Pin
thepast27-Sep-18 2:54
thepast27-Sep-18 2:54 
AnswerRe: How to allow null value inside datetime Pin
OriginalGriff27-Sep-18 4:19
mveOriginalGriff27-Sep-18 4:19 
QuestionHow to do server side pagination and searching in bootstrap table Pin
Member 1148667427-Sep-18 2:26
Member 1148667427-Sep-18 2:26 
AnswerRe: How to do server side pagination and searching in bootstrap table Pin
Richard Deeming28-Sep-18 1:11
mveRichard Deeming28-Sep-18 1:11 
Questionstudent's concern Pin
Member 1399919126-Sep-18 20:44
Member 1399919126-Sep-18 20:44 
AnswerRe: student's concern Pin
OriginalGriff26-Sep-18 21:01
mveOriginalGriff26-Sep-18 21:01 
AnswerRe: student's concern Pin
Richard MacCutchan26-Sep-18 21:16
mveRichard MacCutchan26-Sep-18 21:16 
PraiseRe: student's concern Pin
Maciej Los26-Sep-18 21:44
mveMaciej Los26-Sep-18 21:44 

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.