How to write data/result in excel or external data source in c#??

Hello Team,
I have automation framework in c#. So there are multiple testmethod and testclasses.....so i havt to write result of every testmethod ...in below format..in excel 
[TestMethod]
public void Demo()
WriteIntoExcel("TestClassName","TestmethodName", Pass/Fail, Time);
I can all info in every methods but i dont know how to write it in excel or any other external datasource after every method .....
Actually i want c# code to which will write data/result in excel ...excel might be saved in shared drive...
Thanks in advance

Hi Mon,
We also could use OleDbConnection to insert data into excel.
using System.Data.OleDb;
using Excel = Microsoft.Office.Interop.Excel;
using Microsoft.Office.Interop;
//in the method section use as :
string datevariable = "02/02/2010";
string namevariable = "Shyam";
string strConnectionString ="";
string cmd;
string filepath = ""C:\\sample.xls";
strConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+filePath+@";Extended Properties=""Excel 8.0;HDR=Yes;""" ;
OleDbConnection conn =new OleDbConnection (strConnectionString);
try
conn.Open();
catch(Exception e)
Console.WriteLine(e);
try
// Insert into Sheetname
cmd = "Insert into [Sheet1$] ( [Date], [Name]) values ('" +datevariable+ "','" +namevariable+ "');
//Similarly you can update also
OleDbCommand cmdUpd=new OleDbCommand(cmd);
cmdUpd.Connection = conn;
cmdUpd.ExecuteNonQuery();
conn.Close();
catch(Exception e)
Console.WriteLine(e);
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How to write export dump commad with no datable data only table structure.

    How to write export dump commad with no datable data only table structure will there and command for hole schma.
    e.g. export dump command for scott schema and all table within scott schema in it no table data should be exported.

    If I understand the question, it sounds like you just need to add the flag "ROWS=N" to your export command (I assume that you're talking about the old export utility, not the Data Pump version).
    Justin

  • How to save query result in excel file

    Hi all,
    How to save query result in excel file from sql*plus tool.
    thank you

    Do you really need an Excel file (binary) or a simple CSV?
    If you just need a CSV then search for DUMP_CSV at http://asktom.oracle.com or at this forum
    If you need formatting and/or multiple worksheets then you can use free tools like
    https://xml-spreadsheet.samplecode.oracle.com/ or https://exceldocumenttype.samplecode.oracle.com/
    Regards
    Marcus

  • How to write Join View Adaptor which will pull data from Siebel and OID ?

    Hi Experts,
    I wanted to write web service call where OIF will talk to OVD than OVD will have join adaptor which will pull few data like msisdn from Siebel and view data from oid like given name and generate SAML assertion.
    I wanted to know how to write join adaptor for the same
    Help Appreciated.

    Hi Experts,
    Is anyone has any idea on webservice call to OIF which will call OVD that will have join adaptor connecting siebel and oid ?
    any help is appreciated

  • How to export the result to excel or txt as the SQL result format.

    Hello,
    I want to know how to export the result of the Oracle select result to a txt or a excel file.What is the command.
    I knew the command of spool,but the format of it export is not the same to the result of Oracle result area.
    Thank you very much.

    Hello Yucky,
    what do you mean by
    the format of it export is not the same to the result of Oracle result areaDo you mean the output of a tool other than SQL*PLUS?
    To enhance the formatting of a spool file you can set
    SET MARKUP HTML ON
    SPOOL ONthis will add html markup to format the output as a html table which you can open in a browser or in excel.
    Regards
    Marcus

  • Powerpivot 2012 on Excel 2010 - External Data connections not saving passwords, having to re-enter password EVERYTIME I refresh data

    Hey Guys,
    Using Excel 2010 with latest version of Powerpivot 2012 available 11.1.3129.0
    For my SQL Server Data connections in Powerpivot I DO NOT have any issue, when clicking refresh it never asks me to enter a password and uses my Windows AD info.
    However, for my plethora of other external data connections (Informix, Oracle, Etc...) that I would like to have fluid use within Powerpivot, big problems.
    Lets start with Oracle. Below is a screenshot of my connection tab within Powerpivot.
    So as you can see, all the details are entered and Allow Saving Password is selected. Now I will close out of Powerpivot and Excel completely and re-open. I will navigate to the Powerpivot tab
    and select Powerpivot Window. And then will select to "Refresh All" and am quickly prompted with the "Data Source Credentials" window to re-enter my data source password, again.
    What I have already tried. The above method for starters in which I use a connection string under Table Import Wizard --> Others (OLEDB/ODBC)... I found it the least annoying route, although
    still have to re-enter password everytime, which is what I hope this forum can help with.
    I also have tried doing a direct Oracle connection in Table Import Wizard but also does not eliminate my #1 problem.
    I have also created an ODC file to try and use that with stored credentials within the file, also still asks for password each and everytime.
    The same thing happens with my other data connections to Informix and DB2. So any help and/or suggestions anyone has would be great. I also cant upload these powerpivots to our powerpivot gallery
    on SharePoint 2010, I have a sneaking suspicion it is due to the version of powerpivot I am currently using.
    Thanks

    Hi there,
    My company is not using Excel 2013, only 2010. So that is what I have to work with. From what I have read this is a huge hole in the Powerpivot 2012 framework and is extremely frustrating. This seems so basic and simple and like something everyone using
    this product would use, and yet it still doesnt work.
    Great feedback. Connect is the right place for this feedback on 2010 as well. Thanks!
    Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • How to write table content into excel quickly?

    Dear gurus, I am fresh to ABAP, could you please so kind advise how can I save a table content into an excel which is stored in certain path efficiently?
    I found a way as following:
    form excel_range_write using lcobj_excel
                                 lc_range
                                 lc_value.
      data: lc_cell type ole2_object.
      call method of
          lcobj_excel
          'RANGE'     = lc_cell
        exporting
          #1          = lc_range.
      perform font using lc_cell 1 '30'.
      set property of lc_cell 'VALUE' = lc_value.
    endform.                    "excel_cell_write
    However if I would like to write everything out, I have to loop the table to fill each cell, is there any easier way? Could anyone kindly help?

    hi Frank
    this is the wiki published by me
    hope it will help u a lot
    https://wiki.sdn.sap.com/wiki/display/Snippets/OLEprogramforconvertingtomultitabexcel
    cheers
    s.janagar

  • How to write Boolean function (If Then Else) For Date Caluclation.

    Dear All,
    I have a scenario where i need to calculate Position time hold by an employee in an organisation.
    I have 2 date Char ( DATE FROM & DATE TO), the problem is that is , If an employee is having
    2/3 position in an organisation its current position End Date is always 31.12.999 as its End date is
    not know. For previous position End Date is maintained.
    My requirement is to calculate Position hold time including Current position.
    Can it be done directly in formula variable with If Then Else condition.
    or i need to write user exit if its exit,
    please guide me for ABAP Code.
    Thanks V V much.
    Regards,

    Hi,
    Following options are available for you:
    1. Is the valid to, valid from dates available as a result of standard time dependency of navigational attributes? if yes , you can not use them in calculations, in such case you may have to write a full fledged routine at formula variable, using uxer exit.
    2. Another simple method, that i would suggest would be using temporal joins (infoSets), that precisely fits you case.
    Helpful links:
    About Infosets:
    [http://help.sap.com/saphelp_nw70/helpdata/EN/ed/084e3ce0f9fe3fe10000000a114084/frameset.htm]
    About Temporal joins:
    [http://help.sap.com/saphelp_nw70/helpdata/EN/11/723c3b35703079e10000000a114084/frameset.htm]
    Hope this helps.
    Cheers,
    Sumit

  • How to write test results of TestStand to a database?

    such as Access databse.

    Hi,
    In The Teststand Reference Manual Chapter 6 -13 Example Data Link and Result Table Setup for Microsoft Access is a step by step guide.
    Hope this helps
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • XPS Controller - How to write points/results of the Relative Move command

    Hi,
    I'm new to Newport XPS Controller and linear stages. I've just figured out how to communicate to the stage via XPS controller and managed to move the stage. I need help on how to get the points that the stage has moved. I guess I could use the gather function but got stuck halfway through. A screenshot of the block diagram and the VI is attached below.
    Henry
    Attachments:
    test.png ‏156 KB
    Test.vi ‏20 KB

    Hey there,
    I am going to make a couple assumptions here, please reply and let me know if they are wrong :)
    I am going to assume the jsp is running on an app server that is separate from the content server and you need to execute the web services from there. I am also going to assume that you are familiar with importing and using java classes on your jsp.
    You have several options in this case:
    1. Generate the stub classes for the WSDL's yourself instead of using the SoapClient class (this can easily be done in eclipse)
    2. Modify the SoapClient.java to be a more generic class instead of a command line argument based class and use your modified class to make the call and display the results.
    3. Use the SoapClient class as is by executing a command line call in your jsp (using java.lang.Process)
    Depending on your comfort level with java and jsp I think #2 would be easier but #1 is the more standard approach. #3 is not recommended but doable
    Hope that helps,
    Andy Weaver - Software Consultant
    Fishbowl Solutions < http://www.fishbowlsolutions.com?WT.mc_id=amw >
    Check out our Oracle Consulting Services Section.

  • How to implement a conversion rule in KC7R (External Data transfer-Tool)

    Hi,
    I am familiar with programming conversion rules in ABAP in the LSMW and IS-U Migration workbench.
    Unfortunately we have to work with EDT (transaction KCLJ).
    I need to implement a simple conversion rule: migration file has the external BP number BPEXT and I must retrieve the internalone (PARTNER) for the migration program.
    So I must implement a short ABAP code (select single * from BUT000 ...).
    Now I see that in KC7R you can use constants and conversion rules. There are also "General Ruels" and "conversion routines".
    Can someone explain how to implement this simple ABAP conversion rule in KC7R giving a short example?
    This would be great.
    EDT is the workst of all SAP Standard Migration Tools I have seen.....
    Kind regards,
    Thomas

    Thomas,
    Coud you please share your findings as I am now in a similar to your original post.
    ie I too would like to know how to code convesions for use within the transfer rules used by KCLJ.
    Kind Regards,
    Hiten Mistry.

  • How to write or send String to an external file in java

    Hi guys...!
    I am writing a program in which I have to send some texts to an external file. If the file is not empty, I want the program to append to that file instead of overwriting the file.
    Any suggestions...guys??
    Thanks...
    --- Spirit_Away

    Hi therer...!
    Thanks for your suggestion... But I forgot to mention
    that I'm using XML in my java program and the method
    "endElement()" for XML throws a "SAXException" and it
    would not let me add another exception next to it
    ...like the one thrown by the "FileWriter", which is
    IOException...
    Thanks....
    --- Spirit_AwayIn that case you might be too stupid to be programming Java.

  • How to dynamically display in Image Field with external pic source

    Hi Guys,
    I have the following scenario:
    I need to have a form that needs to display an x amount of images on the same page area.  I have not found any documention with regards to creating an undisclosed number of Image Field elements, so I am experimenting with using a Table to display entries of type Image Field.
    I do not know at design time which pictures will be shown in this table.  This needs to be calculated dynamically when an Incident Number is supplied to the Java WebDynpro application that uses Adobe LiveCycle Designer (Dont worry about this).
    Now, first of all: Is it possible to use the URL of images that are OUTSIDE the form structure?  In other words, usually one would imbed the image in the forms structure, but because I do not know this image's URL at design time I need to pass it dynamically?  Please comment!
    Also, what is the FormCalc syntax for accessing a field in the "Data View" view at the left side of the designer?  For example, If i want to access the following part in the "Data View"view, what syntax should I be entering in the script editor:
    I would like to access this value as I would like to append it to the end of this statement so that I can get the value dynamically:
    this.value.#image.href=  ???????

    You cannot change the url of the image on the fly for security reasons.
    In your case you have to use the dynamic image fields in the xdp form, encode the external  images with base64 encoding to be a string, populate with those strings the xml and render  your template with this xml.
    Here: http://eslifeline.wordpress.com/2008/09/05/inserting-image-in-a-xdp/#comments you have a good example by Girish Bedekar for such a process.
    Yan.

  • Routines for File name at External Data in Info Package level.

    Hi All,
    Can any one give the example codes of how to write the routine for Files at External Data in Info Package level.
    Regards
    srinivas

    Hi Srinivas
    Here iam attaching a sample code in the infopackage level this code is used to select the Current version from TVARV table ..based on the version from variable the data is loaded into the ods..
    data: l_idx like sy-tabix.
              read table l_t_range with key
                   fieldname = 'FISCPER'.
              l_idx = sy-tabix.
    tables tvarv.
    data: v_prever(6)   type c,
          v_fiscper(7)  type n.
      clear tvarv.
      select single low
       from tvarv
       into v_prever
      where name = 'ZBSK_PREVIOUS_RELEASED_VERSION' and
            type = 'P' and
            numb = '0000'.
    concatenate v_prever(4) '0' v_prever+4(2) into v_fiscper.
       concatenate  '0' v_prever+4(2) v_prever(4) into v_fiscper.
            l_t_range-low = v_fiscper .
              modify l_t_range index l_idx.
    Hope the above code helps you..
    let me know in case of any concerns.. and further help needed..
    bye
    Shu Moh..

  • How to Write a trigger to hold session data

    Hi Everyone,
    There are 4 Weblogic Servers which are connected to the database concurrently. In the database I have Application Users table "USERS". When a user is logged to the application let us say userA(from "USERS" table) is logged into the application, whenever that same userA logged into the application from other Weblogic server(other system) it should not allow to login into the application. Is it possible to write a trigger for this. If possible, Can any body suggest how to write a trigger to hold that UserA data into one temporary table as long as that userA is active and removes the data from temporary table when userA logged off (OR) as well as that Weblogic server is goes down.
    Thanks in advance.

    Hi Justin,
    First Thank you very much to all of you.
    1. Yes Application Users are authenticated only once,
    that to at the time of login to the Application.
    2. We are not running any script that informing the
    message like "connections
    from the downed server should be reset". Do you
    you think is it suggestable.
    It's not mandatory to use triggers only.Can we
    achieve this by maintaining any temporary table.
    I have one idea is that, Lets create a table name
    e "App_Users_Session_Data(User_Id,Is_Active)"
    If "User A" logins into the application then User_Id
    = 1A and Is_Active = 'T' will be entered
    automatically into the table
    "App_Users_Session_Data". When same "UserA" logins
    from other Weblogic Server then Application first
    check this table and informing that "UserA" already
    logins and is active.
    Whenever "UserA" loggsoff then this entry will be
    automatically deleted.
    My doubt is "UserA" logins successfully into the
    application and corresponding user entry is there in
    "App_Users_Session_Data". If Weblogic Server goes
    down from where this UserA logins, This entry will
    not be deleted. If this entry is still there then the
    same UserA should not login into the application from
    the same Weblogic server(which is up again). My doubt
    is how to remove this entry automatically when
    Weblogic server goes down. Can we achieve this by any
    other way. If possible can u give some guidelines
    thats enough for me.
    Thank you everyone
    SankarHi,
    First off all and as I undeerstood you can change your application.
    1- A table say weblogic_servers have to be created:
    Several scenarios are possibles. If you want you can have a row per weblogic server in this table with what you want as identifier. Any way this table can have a column (sid for example) which identifies the weblogic database session. This can be managed by logon and logoff triggers for the related database user. The logoff trigger for example deletes all lines in App_users_Sessions_Data (see below) related to the same session as the weblogic server and puts the session sid in weblogic_servers to NULL.
    2- Change the table App_Users_Session_Data:
    You have to add a column (sid for example) linking the app user to the database session of the weblogic server. When a user connects, you can check if the databse session is always there and decide accordingly.
    A good idea in my opinion is to centralize your logic by putting it in an INSERT trigger on App_Users_Session_Data.

Maybe you are looking for

  • Unquoted special character error

    Am reading data from a file and parsing through it using StringTokenizer. I am putting the data into DB2 tables and therefore need to set the integer and fraction count for decimal numbers so they won't abend the program if they are over the DB2 sett

  • Severe error(s) occurred in phase PREP_INSTALL/SHDINST_OS Last error code set: Process H:\SUM\abap\exe/sapstartsrv.exe exited with -1

    Hi Experts , Currently performing EHP7 upgrade I have faced error during the configuration phase , below attached was the error screenshot . error logs shows the below : Executing module 'PREP_INSTALL'. Execution of PREPARE module "Installation" begi

  • Problem with Pacman 4

    Alright, I just built a new computer and installed the core version of Arch on it from a freshly burned CD. When I ran pacman -Syyu, I had to upgrade pacman. I did so without errors. However, when I do the same command afterwards I get this output: e

  • Entire computer freezes when I attempt to sync my iPod

    Every time I attempt to sync my iPod (video - I think it is a 5th gen??) my whole computer freezes immediately. It doesn't even get a chance to show that my iPod has been plugged in. The iPod itself acts as if it hasn't been plugged in at all - it do

  • List of sales order using particular Material

    Hi, I want to see a list of sales orders from starting from beginning which have used a particular material say ZZZZ as one of its line item. Regards AK