How to dynamically set connection string for report in C# code?

Hi,
I have installed CRVS2010. I have created new Crystal Report WPF Application and new report. I would like to set connection string for report in code dynamically.
Is this possible?
Thanks
Ivana

Lots of posts in this forum on how to set database connections. WPF should not be a consideration as it's just a viewer. The report engine is still the same. Search these forums. Use the search box at the top right corner of this page. Look at samples here:
https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
Note that none of the samples above are using WPF, but like I said, the WPF is just a different viewer and will not impact how the report engine logs on to a database. (I think of it as a gray car vs. a red car. Same engine, just the color is different)
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

Similar Messages

  • How to dynamically set width of SSRS columns in custom code?

    How can I change the width of a table column based on a parameter value using custom code in SSRS?
    If the parameter value is "Excel", I'd like the width to be 2 inches. If the parameter value is "Standard", I'd like the width to be 1 inch.

    Hi mmx_pdx,
    Based on my research, we can only type static values for the width size in report. In Reporting Services, it not supported to set the size of width based on an expression currently. This is by design.
    Personally, I recommend you that submit this suggestion at
    https://connect.microsoft.com/SQLServer/. If the suggestion mentioned by customers for many times, the product team may consider to add the feature in the next SQL Server version. Your feedback is valuable for us to improve our products and increase the
    level of service provided.
    Thanks for your understanding.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Report Designer odbc connection string for data source using a parameter

    I am using stand alone report designer 3 for the present and have a question/problem regarding the odbc connection string for MySQL when setting up the data-source
    I need to be able to enter a parameter which is the database name i.e. BOE-201401 or say BOE-201312 etc  from a list of databases the user can choose from.
    at present the odbc connection string points to BOE-201402
    the connection string is at present  Dsn=Development Server for MYsql;description=MYSQL;server=ldndw01;database=BOE-201402;port=3306
    my parameter has the name BOE_DATABASE
    and in an expression it is  as such
    =Parameters!BOE_DATABASE.Value
    I want to point the datasource for the report to the parameter value before the user sees the report.

    Hi Leslie,
    Based on your description, we want to design a report with a dynamic DataSource connection string. There are the basic steps below for your reference:
    Create report with static database.
    Change data source to report parameter.
    Send new database connection string as a report parameter. 
    More detail information, please refer to the following blog: Dynamic Database in SSRS 2008.
    http://haseebmukhtar.wordpress.com/2011/11/09/dynamic-database-in-ssrs-2008/
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • How to change connection string for a form created with b1de

    Hi all
    i've created a form using the Code Generator tool ob B1DE
    My question is how can i set the connection string to a different server and database. doing so after the creation wizard has finished?

    Hi,
    Why do you need to change the connection string? What are you calling "connection string for a form"???
    The only connection string I now about is the one used to connect to the UI API... and this one is fixed for all apps in debug mode and given as parameter when your addon is registered in B1.
    The connection string is filled in the code of your generated addon.
    Please go to the main class of your addon, in the main method you have the following code where the connection string is filled either with the command line parameters (release mode) or with the fixed value given by SAP. This code doesn't need to be changed...
            public static void Main()
                int retCode = 0;
                string connStr = "";
                bool diRequired = true;
                // CHANGE ADDON IDENTIFIER BEFORE RELEASING TO CUSTOMER (Solution Identifier)
                string addOnIdentifierStr = "";
                if ((System.Environment.GetCommandLineArgs().Length == 1)) {
                    connStr = B1Connections.connStr;
                else {
                    connStr = System.Environment.GetCommandLineArgs().GetValue(1).ToString();
                try {
                    // INIT CONNECTIONS
                    retCode = B1Connections.Init(connStr, addOnIdentifierStr, diRequired);
    Regards
    Trinidad.

  • How do I set individual properties for a column in report layout at runtime

    How do I set individual properties for a column in report layout at runtime? I need to change this based on a user's input. This is for v10g.
    I need to change either the "Read from File" attribute or the "File Format" attribute for one column based on the user's input. IS this possible?
    Thanks in advance!

    Hi,
    define 2 columns and use format triggers to show the one or the other column.
    Regards
    Rainer

  • Dynamic excel connection string

    Hi, 
    I have excel file as source, where the file name can be anything; so to fetch the data from the excel file, I wanted to create a dynamic excel connection string. 
    So these are the following steps I have followed:
    1. For Each Loop: 
    Step 2:
    Step 3: Excel Connection string
    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Product\Marketing__Products___Services.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES";
    Connection String Expression : @[User::SourceFolder]+ @[User::SourceFile]
    And Below is the error I'm getting
    TITLE: Microsoft Visual Studio
    The component reported the following warnings:
    Error at PlanningIT_Service [Connection manager "Excel Connection Manager"]: The connection string format is not valid. It must consist of one or more components of the form X=Y, separated by semicolons. This error occurs when a connection string
    with zero components is set on database connection manager.
    Error at PlanningIT_Service: The result of the expression "@[User::SourceFolder]+ @[User::SourceFile]" on property "\Package.Connections[Excel Connection Manager].Properties[ConnectionString]" cannot be written to the property. The expression
    was evaluated, but cannot be set on the property.
    Choose OK if you want to continue with the operation.
    Choose Cancel if you want to stop the operation.
    BUTTONS:
    OK
    Cancel

    Hi,
    *) Make sure file names are retrieved properly:
    A.txt if you have Name and extension under Collection tab - > Retrieve file name
    A  if you have Name only under Collection tab - > Retrieve file name
    C:\Users\sathya\Desktop\Source_Folder\A.txt  if you have Fully qualified under Collection tab - > Retrieve file name
    *) variable property - Set EvaluateAsExpression = True
    Try below links for examples:
    http://msdn.microsoft.com/en-us/library/ms345182.aspx
    http://mikedavissql.com/2013/09/16/loop-through-excel-files-in-ssis/
    http://www.allaboutmssql.com/2012/09/sql-server-integration-services-rename.html
    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

  • How to determine the connection string to a SQLite database, in C# code

    Hello. I'm trying to figure out how to specify the connection string to a SQLite database, I would like to access using the following code:
    string connectionString = null;
    SqlConnection connection;
    SqlCommand command;
    SqlDataAdapter adapter = new SqlDataAdapter();
    DataSet ds1 = new DataSet();
    string sql = "SELECT DataName, Data, Id, UserId, DateLastUpdated FROM MainTable";
    connectionString = "Data Source=C:\\SQLITEDATABASES\\SQLITEDB1.sqlite;Version=3;";
    connection = new SqlConnection(connectionString);
    try
    connection.Open();
    command = new SqlCommand(sql, connection);
    catch
    The value I assigned to the variable connectionString, in the code above, I obtained somewhere from the Internet. It does not work. I'm using Visual Studio 2013, against the file sqlite-netFx451-setup-bundle-x86-2013-1.0.96.0.exe, which
    I installed, and got from
    here.
    My application's App.config file looks as follows:
    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <configSections>
    </configSections>
    <connectionStrings>
    <add name="DC_Password_Saver.Properties.Settings.DC_Password_SaverConnectionString" connectionString="data source=&quot;C:\Users\patmo_000\Documents\Visual Studio 2013\Projects\DC Password Saver\DC Password Saver\DC Password Saver.db&quot;" providerName="System.Data.SQLite.EF6"/>
    </connectionStrings>
    <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
    </startup>
    </configuration>
    I tried to use the value assigned to connectionString in the XML settings above, replacing single backslash characters with double backslash characters, because the Visual Studio editor flagged them as unrecognizable, and wound up with the
    following.
    SqlDataAdapter adapter = new SqlDataAdapter();
    DataSet ds1 = new DataSet();
    string sql = "SELECT DataName, Data, Id, UserId, DateLastUpdated FROM MainTable";
    connectionString = "data source=&quot;C:\\Users\\patmo_000\\Documents\\Visual Studio 2013\\Projects\\DC Password Saver\\DC Password Saver\\DC Password Saver.db&quot;";
    connection = new SqlConnection(connectionString);
    The above code however does not work either. So again, does anyone know how I can specify in C# code, a connection string to access my SQLite database? Thanks in advance for your reply.

    What does SQLite connection strings has to do with WPF?
    You will find some valid connection strings here:
    https://www.connectionstrings.com/sqlite/
    But you cannot use the SqlConnection class to connect to a SQLite database. You will need to download and add a reference to the System.Data.SQLite library and then use the SQLiteConnection class:
    connection = new System.Data.SQLite.SQLiteConnection(connectionString);
    try
    connection.Open();
    command = new System.Data.SQLite.SQLiteCommand(sql, connection);
    catch
    Please refer to the following article for more information and an example of how to connect and read and write data from an SQLite database using C#:
    http://blog.tigrangasparian.com/2012/02/09/getting-started-with-sqlite-in-c-part-one/.
    There is contains a link where you can download the required assemblies.
    Hope that helps.
    Please remember to mark helpful posts as answer to close your threads and then start a new thread in an approproate forum if you have a new question.

  • HT2534 How do I set a acount for my Apple TV

    How do I set a acount  for my Apple TV

    Hi Dennis,
    The password (to protected unauthorized access) to your wireless network is set on your wireless router. Typically most routers come with a setup wizard, either that involves running an installation sequence (via CD/DVD) or by connecting to the router via a web-based control panel and configuring the router that way. In addition to setting a password to access the network you'll also want to set a username/password for accessing the router to perform administrative tasks.
    You'll want to consult the manufacturer of your router for additional setup assistance, or the manual/quick start guide that came with the product.

  • How to dynamically set column name in Answers

    Hi.
    How to dynamically set column name in Answers, for example I want to put presentation variable in column header. Is this possible?
    Regards,
    Goran Ocko
    http://108obiee.blogspot.com/

    May be a rude way .. but it works.
    Add narrative view and use Java script to change the column headings based on the variables.
    <script language="javascript" type="text/javascript">
    var a = document.getElementById('idResultsTableParent');
    var rows= a.getElementsByTagName('tr');
    rows[1].cells[1].innerText ="@{Presentation Variable}";
    </script>
    Editing the same post to remove irrelevant information.
    - Girish

  • Hi expert,Incorrect connection string for addon

    hi expert
    I am getting error when connect  my addon in client pc.
    my addon working fine in server at client side.
    but in client i m getting error "Incorrect connection string for addon".in my addon i am using crystal report and two sap b1 user form. thanks in adva.
    regards
    Rajkumar Gupta
    Edited by: Rajkumar Gupta on May 23, 2009 12:49 PM

    Hi Rajkumar,
    Sometimes this error message is related to the UI server. Please see note 808354 or 852031 and see if this has any effect.
    If not, please post up a code sample so we can take a look,
    Regards,
    Niall

  • How to get the connection string at runtime

    Hi,
    I'm using Forms6i.
    I'm using EXEC_SQL to execute a dynamic sql in my form.
    I need connection string for that . But i cannot give it hardcodingly.
    Is there any form's properties to get the database connection string, to which the form is connected ?
    Thanks

    Hi,
    I've the user i/p columns
    EmpNo, Dept ,Holicode and , From and To Date.
    In which From and To Date is mandatory.
    In one table, emp_cal_header, i have all the holidays defined for each of the employees for a year.
    The records like
    EmpNo    Holicode     Holidt
    001        Frioff         02/07/2011
    001        Satoff        03/07/2011
    001        Frioff         08/07/2011
    .....So i want the final o/p in Excel like
    If user i/p is from Date: 01/07/2011 ,ToDate:09/07/2011, EmpNo :001
    EmpNo   Dept     Total  01/07/2011   02/07/2011 ..... 08/07/2011  09/07/2011
    001        IT        3               FriOff           Frioff            For this i'm constructing a dynamic sql like this
         qry := '(Select ech_emp_code cal_emp_code,emp_name CAL_EMP_NAME,emp_dept CAL_EMP_DEPT,count(ech_date) CAL_TOTAL'||date_cols||'
                             from (Select ech_emp_code,em.emp_name||'' ''||em.emp_middle_name||'' ''||em.emp_last_name emp_name,em.emp_dept emp_dept,ech_code,ech_desc,ech_date
                                            from emp_cal_header ,employee_master em
                                where emp_cal_header.ech_emp_code = em.emp_code
                                and  ech_emp_code = '||nvl(:emp_code,'ech_emp_code')
                                ||' and em.emp_status IN (''P'',''C'')'
                                ||' and em.emp_dept = '||dep
                                ||' and ech_date between '''||to_date(to_char(:From_dt,'DD-MON-YYYY'))
                                ||''' and '''  ||to_date(to_char(:To_dt,'DD-MON-YYYY'))
                                ||''' and ech_code = '||holi
                                ||' order by ech_Date)
                 group by ech_emp_code,emp_name,emp_dept)';
    and date_cols is constructed as
         todt := :from_dt ;
         i := 0;
         loop
              i := i+1;
              dt  := to_char(todt,'dd-MON-YYYY');
              date_cols     := date_cols||','||'max(decode(to_char(ech_date,''dd-MON-YYYY''),'''||dt||''',ech_CODE)) DT'||i;
              todt := todt + 1;
              Exit when todt > :to_dt ;
         End loop;This query i'm executing using EXEC_SQL.
    Since date_cols can be constructed only based on user i/p , i'm not able to do just a normal query
    Any help

  • How to use multiple VCI strings for lap 1300 and 1200 (option 60) in one pool?

    Hi All,
    Hope to you a very happy new year,
    I have two differnt LAP 1300 and 1200 in my network and I need to add theme to the WLC,
    I successed to add one of theme by the option 60 in the DHCP pool at the Core SW,
    So my quetion is below:
    How to use multiple VCI strings for lap 1300 and 1200 (option 60) in one pool?
    Thanks in Advanced,
    Ahmed,

    To add to Scott's post.  Option 60 would be useful if you needed to put certain types of AP on specific controllers.  Otherwise, no real need to use it for the most part.
    Though, I do recall an issue a few years ago that some windows machines had issues getting DHCP if option 43 is being returned.
    Now, on an IOS switch, you can only configure one option 60 per DHCP scope
    HTH,
    Steve
    Please remember to rate useful posts, and mark questions as answered

  • How do I set a reminder for the last day of every month

    Have I missed something? But how do you set a reminder for the last day of every month to recurr indefinatley in iOS6? Sorry if this is really simple but I just can't seem to work it out. Any help gratefully received.

    Hey Mattye88 not sure if you have seen but actully you can do this, but for some reason you have to use Siri.  If you bring up Siri and say "set a reminder ever 4 weeks from next wednesday to check the gas meter" it will set one and it will work just fine, I have reminders to water a Bonsai every three days and it works fine it just shows as custom repeat on the user interface.  Alas it seems you can not use Siri to set one for the end of the month though which is why I am in this threed.  Still hope it helps you to know how to sort this problem atleast.

  • How do I set numbered lists for headings in Pages 5.2, and keep that system of numbered lists saved?

    I have tried to set numbered lists for headings in Pages 5.2 but have not succeeded. I have read similar questions concerning this but this has not helped me...
    When I say numbered lists I mean something extremely important and simple, for instance:
    1. Introduction
    1.1. Background
    1.2. Purpose and Questions
    2. The Legality of Clause X
    2.1. Legality under Article 101.1
    2.2. Legality under Article 101.3
    And so on...
    Heading 1. is selected as "Heading", 1.1 is selected as "Heading 2", and if I had 1.1.1 it would be selected as "Heading 3" and so on...
    I have navigated my way to the Format window, and under the tab "Style" and down to "Bullets & Lists". I have here selected the following: Numbered, Numbers, 1. 2. 3. 4., Tiered Numbers, Continue from previous.
    There are several problems with this currently.
    First, based on the example it becomes "2. Background" when it should be "1.1 Background" instead.
    Second, after writing some body text between the headings and then select a new heading, all the previously selected settings I mentioned above in "Bullets & Lists" have to be reselected.
    So, how do I set numbered lists for headings, or so called sub-headings, in Pages 5.2? And how do I keep that selected system of numbered lists saved so I don't have to retype it for every new heading I type? (e.g. so that Pages knows that every time I choose Heading 2, I want it to number the heading in the way selected)
    Obviously, manually writing the numbers for every heading is not a viable option, as it makes table of contents problematic and is simply tedious. You need an automatic way of doing it, especially if you write long documents where keeping headings in order is absolutely essential.
    Also, reverting back to previous Pages versions (like v. 9 I think?) is not an option as that does not exist on my recently purchased Macbook Pro.
    I need to be able to do this on Pages 5.2 and do it automatically.
    I appreciate any help with this.

    iWork '09 is not "outdated" it still works and works extremely well and whilst not perfect with MsWord it is far far better than Pages 5.2 which has a stream of major issues with exporting. It is also way better and faster to use than Microsoft Office.
    So what is your time and work actually worth? If it is less than $19.99 for 6 months, you may as well just chuck it in and take that job on minimum wages.
    You are assuming things for Office 2014 with absolutely no inside knowledge. Much as we assumed Pages 5 was going to be the long awaited improvement, but ended up being a downgrade to match the iOS version, Microsoft is headed the same way with their mobile versions.
    This is not like getting the "latest" pair of pants where you go with the crowd and throw out your cigarette legs which replaced the flares, which replaced your low cuts which replaced your cigarette legs, which replaced…
    This is work.
    If it does the job and does it well, use it. There is nothing out there to really match what Pages '09 does. Yet.
    LibreOffice can do most but not all, but has a UI that only a mother could love. It's great redemption is that it uses both open formats and the standard Microsoft formats and is under active development. It also opens and saves to just about everything. When they finally work out the Pages formats, I'm sure they will open those as well.
    I use a lot of professional software. Just because the publisher's marketing department says change the product so we can sell more, doesn't mean you have to pay any attention whatsoever. Adobe being a classical example. Most designers are just ignoring their latest subscription based bloatware and getting on with their work.
    Peter

  • How can I set a password for firefox so that everyone have to enter the password before executing firefox

    My younger sister executed my firefox just at this afternoon(she originally use IE), and she saw something that can't be seen. How can I set a password for firefox so that everyone have to enter the password before executing firefox?

    Also see this for an English version of Profile Password:
    *Profile Password: http://nic-nac-project.de/~kaosmos/profilepassword-en.html#PPF
    It is an extension to protect the profile with a password, but being an extension that protection can easily be bypassed by starting Firefox in [[Safe mode]].<br />
    So do not rely on it.<br />
    If you want to protect content then you have to use methods supported by the OS like a separate user account with a password or an encrypted file system.

Maybe you are looking for