Click here to Skip to main content
15,904,416 members
Home / Discussions / C#
   

C#

 
AnswerRe: Beginning Student Array Question Pin
Dave Kreskowiak30-Sep-18 17:56
mveDave Kreskowiak30-Sep-18 17:56 
AnswerRe: Beginning Student Array Question Pin
OriginalGriff30-Sep-18 19:51
mveOriginalGriff30-Sep-18 19:51 
QuestionPython httpServ.request in C# - HttpWebRequest ? Pin
Member 1400288230-Sep-18 9:59
Member 1400288230-Sep-18 9:59 
AnswerRe: Python httpServ.request in C# - HttpWebRequest ? Pin
Richard MacCutchan30-Sep-18 21:08
mveRichard MacCutchan30-Sep-18 21:08 
GeneralRe: Python httpServ.request in C# - HttpWebRequest ? Pin
Member 140028821-Oct-18 11:26
Member 140028821-Oct-18 11:26 
QuestionSwitching 2 Variables Pin
Member 1400283730-Sep-18 8:19
Member 1400283730-Sep-18 8:19 
AnswerRe: Switching 2 Variables Pin
Dave Kreskowiak30-Sep-18 8:53
mveDave Kreskowiak30-Sep-18 8:53 
GeneralRe: Switching 2 Variables Pin
Member 1400283730-Sep-18 10:55
Member 1400283730-Sep-18 10:55 
AnswerRe: Switching 2 Variables Pin
BillWoodruff14-Oct-18 15:35
professionalBillWoodruff14-Oct-18 15:35 
QuestionFundamental misunderstanding of structs as "value" types Pin
bh_28-Sep-18 3:54
bh_28-Sep-18 3:54 
AnswerRe: Fundamental misunderstanding of structs as "value" types Pin
OriginalGriff28-Sep-18 4:12
mveOriginalGriff28-Sep-18 4:12 
GeneralRe: Fundamental misunderstanding of structs as "value" types Pin
bh_28-Sep-18 4:49
bh_28-Sep-18 4:49 
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 

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.