You must Sign In to post a response.
  • Category: ASP.NET

    Need answer for today Interview Questions in HCL

    Hi Friends,

    Today i attend the interview at HCL. They asked lot of questions and below are the questions where i could not answered. Could you please help me.

    1) How to insert 5 aspx page data into database. Each page have 10 fields and final (5th page) page have the insert button control.
    2) How to insert bulk data into sql database. After my answer they ask what are the drawback to use it.
    Note: i answered to use bulk insert method).
    3) How to display the common error page (that the client should now why this error came. for example "The inserted date format is wrong"). CatchBlock thru the common error message, but the client does not know what is that error. so what to do to client know.
  • #766223

    1.We can assign values maintain in every Page for ex:


    or pass Query String in every page


    Of course correct Bulk insert have in sql server.


    we can wrote the code

    How to display the common error page in C# try catch block pass the error message

    ///Correct Code
    catch(Exception ex)

    How to display the common error page in webconfig

    <customErrors mode="On" defaultRedirect="~/error.aspx">
    <error statusCode="404" redirect="~/error.aspx" />

    Name : Dotnet Developer-2015
    Email Id

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #766227
    1. How to insert 5 aspx page data into database. Each page have 10 fields and final (5th page) page have the insert button control.
    - There are multiple ways to handle this conditions, better to use Session variable, where you can collect data from each page and store it in a datatable and finally on insert button loop on session datatable and insert the values in database and then you can clean session variable to reclaim memory

    2. Draw back of bulk method
    - basically, BULK INSERT enforces strict data validation and data checks of data read from a file that could cause existing scripts to fail when they are executed on invalid data,
    - Many times string-to-decimal data type conversions failed
    - When using a format file with BULK INSERT, you can specify up to 1024 fields only. This is same as the maximum number of columns allowed in a table
    3. How to show common error message to user, it should be user-friendly
    - Create a custom exception class that includes a property to hold the user-friendly message, and then, when an error occurs, instantiate a new exception object of the custom type in the Catch block of your error-handling code, set the property of the exception to the desired message, and then throw the new exception.
    for more details see below link

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #766228

    You can store each page data into session object and finally save the session data into database, if you want to show error details to client then in Global.asax page you can handle errors in Application_error event.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #766253
    Hi All,

    Thanks and your reply on question number 2 & 3.
    For the 1 question I replied the same answer.. but they except some other method... is there any way apart from this...

    Gopi A.
    +91 9894315571

Sign In to post your comments