How to add hashes to sql querys

The data I wish to add to mysql contains characters such as " and ' and so i get and exception when updating the database.
How do I add hashes to the string so that I won't get the error:
ie really "cool" becomes really /"cool/"
though hashes should be other way round (french keyboard does not have backslash)
thanks

Don't use Statement, use PrepareStatement, then you don't have to worry about "hashes" (which us yankees call "quotes").
Something like:
  static final String sql = "select first_name, last_name from account where userid = ?";
  PreparedStatement pstmt = connection.prepareStatement(sql);
  pstmt.setString(1, "o'henry");
  ResultSet rs = pstmt.executeQuery();In the long run, it's easier, scales up better, is more secure...

Similar Messages

  • How to add hash table values to SQL Table using Powershell

    Hi,
    I have sharepoint list with four(column1, column2, column3,column4)columns.I am reading the list column values and adding to hashtable. Now I want to add values from hastable to SQL table with four(column1, column2, colum3,column4)columns using powershell.
    I have written the following script for single column but I would like to know how to add values for multiple columns.
                if(($key -eq "Column1") )
                   $SqlQuery = "INSERT INTO [TableName] ([Column1]) VALUES ('" + $HashTable.Item($key) +"')"
                   #Set new object to connect to sql database
                   $connection = new-object system.data.sqlclient.sqlconnection
                   $Connection.ConnectionString ="server=SQLServerName;database=SQLDBName;Integrated Security = True;"
              $connection #List connection information 
                   $connection.open() #Open Connection
                 $Cmd = New-Object System.Data.SqlClient.SqlCommand
                 $Cmd.CommandText = $SqlQuery
                   $Cmd.Connection = $connection
                  $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
                  $SqlAdapter.SelectCommand = $SqlCmd
                  $DataSet = New-Object System.Data.DataSet
                  $SqlAdapter.Fill($DataSet)
                  $DataSet.Tables[0]
                  $connection.Close()
    Can anybody please help me out to accomplish the task? Any help would be greatly appreciated.
    AA.

    Hi AOk2013,
    Not knowledgable on PowercShell, based on my understanding on HashTable in Java, Some modification you can make in your code to achieve your requirement.
    If the Keys in HashTable are "Column1","Column2","Column3","Column4", you can reference below.
    if(($key -eq "Column1") ) #what is the purposed of this if ?
    #$SqlQuery = "INSERT INTO [TableName] ([Term]) VALUES ('" + $HashTable.Item($key) +"')"
    #specify the real column names in the table
    $SqlQuery = "INSERT INTO [TableName] ([ColumnA],[ColumnB],[ColumnC],[ColumnD]) VALUES ('" + $HashTable.Item("Column1") +"','"+ $HashTable.Item("Column2") +"','"+$HashTable.Item("Column3") +"','"+$HashTable.Item("Column4") +"')"
    #Set new object to connect to sql database
    $connection = new-object system.data.sqlclient.sqlconnection
    $Connection.ConnectionString ="server=SQLServerName;database=SQLDBName;Integrated Security = True;"
    $connection #List connection information
    $connection.open() #Open Connection
    $Cmd = New-Object System.Data.SqlClient.SqlCommand
    $Cmd.CommandText = $SqlQuery
    $Cmd.Connection = $connection
    $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
    $SqlAdapter.SelectCommand = $SqlCmd
    $DataSet = New-Object System.Data.DataSet
    $SqlAdapter.Fill($DataSet)
    $DataSet.Tables[0]
    $connection.Close()
    Since your question is regarding PowerShell, I would suggest you post it in a dedicated
    PowerShell Forum. It is more appropriate and more experts will assist you.
    If you have any feedback on our support, you can click
    here.
    Eric Zhang
    TechNet Community Support

  • How to add PSP (PL/SQL Server Page) application to an Oracle Apps 11i menu

    How can I add a small application (drilldown search) I developed using psp (pl/sql server page) into a menu inside Oracle Apps 11i?

    Hi
    Here's how I do it:
    1. Create the function.
    In the Function Type use one of the PLSQL options, for example WWK which is a popup PL/SQL function.
    In the web_html_call, simply add the package.procedure
    2. Setup Security
    In order to be able to call a PL/SQL procedure from a web page, you need to add it to web enabled PL/SQL
    Do this in System Administrator, under "Security / Web Enabled PL/SQL " or similar (can't remember offhand)
    3. Make the call
    You should then be able to call it using
    http://server:port/pls/DBSID/package.procedure
    Obviously substiture DBSID for you database SID.
    Should work, done it loads..
    Chris

  • How to add description of a column of a table in SQL Azure

    Hi
    I have some tables in my application database where there are descriptions added against certain columns. Needless to say they were done by using sp_addextendedproperty.
    Now I am trying to migrate the Database to SQL Azure. SQL Azure does not support sp_addextendedproperty.
    Hence I am not able to figure out how to add descriptions to those columns.
    Any help would be much appreciated.
    Thanks
    Soumyadeb

    Hello,
    Just as Latheesh post above, Windows Azure SQL database are not support extended stored procedures. That’s one of the limitations on SQL database, and I don’t know there is another way to achieve the same on Azure.
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • SQL Server Distributed Partitioning Views how to add a new node online

    We are using distributed partitioning views in SQL Server 2012 Enterprise Edition for scaling out our data across more than one servers. Now we faced to question how to add a new node (server) into the scale outed db servers system without sending the servers
    down, so our users will be able to use them during the process as well.
    For example we have 4 servers with scaled out data. When we add the new empty server, the CHECKINGs for the partitioning columns should be reorganized. But during the process the partitioning views are not working.
    The High Availability, Always On or Failover Cluster approaches seem are not resolve the problems.
    So my question is how to add new node online?
    KH

    Thank you Erland for the reply.
    Yes, it's sounds as possible solution but has some not resolvable nuance in it. Let's say we copied some data from Node5 to new added Node6. Let's assume in Node5 we had data in Table1 with partitioning column's values 100,101,102,103,104,105,106.  Now
    we want to copy part of the rows with partitioning column's values 103,104,105,106 from Node5.Table1 into Node6.Table1. With this Node5 will contain less data and will work more quickly (less IO, less CPU usage etc), and the rest data will be contained on
    Node6. But because of Node5 is already in use, the Node5.Table1 contains CHECK CONSTRAINT = ParttionColumn should be from 100 up to 106. This is check for Node5. The Distributed Partitioning Views are already using the CHECKs to identify what server should
    be used to get data from.
    Now when we copied part of the Node5.Table1 rows to Node6.Table1 the views are still using the 103-106 rows from Node5.Table1 because the CHECK points there. Then we include the newest Node6.Table1 in the distributed partitioning views. OK, but we should
    set some CHECK on new Node6.Table1 which will be used by views. We can't set intersecting checking like Node5 has CHECK 100-106 and Node6 has CHECK 103-106. We also can't edit Node5 check and set it 100-102 untill the data will be removed in it. But this means
    that the data will not be available during the execution. 
    So, any ideas ?
    KH

  • How to add a service account in SQL Server to display the "Service Account Name" and "Display Name"

    Can someone
    help with steps on how to add the following in SQL Server 2012 environments?<o:p></o:p>
    "Service Account Name" and "Display Name"<o:p></o:p>
    Your help will be greatly appreciated.<o:p></o:p>
    leonie6214

    Hello,
    Is the following article what you are looking for?
    http://msdn.microsoft.com/en-us/library/ms345578.aspx
    If not, could you explain a little bit more what you want to accomplish?
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • How to add sql lite winrt

    I am Beginner winrt and sql lite ,  I am creating app that Customer table
    I want how to add data to the Table, edit the data, delete selected data, and delete all
    Please help me Any One
    Here code maybe wrong please right code provide me
    using SQLite;
    namespace MVVM.Models
        public class Customer
            [PrimaryKey, AutoIncrement]
            public int Id { get; set; }
            public string Name { get; set; }
            public string City { get; set; }
            public string Contact { get; set; }
    /////  Relay Command
    /// <summary>
        /// A command whose sole purpose is to relay its functionality
        /// to other objects by invoking delegates.
        /// The default return value for the CanExecute method is 'true'.
        /// <see cref="RaiseCanExecuteChanged"/> needs to be called whenever
        /// <see cref="CanExecute"/> is expected to return a different value.
        /// </summary>
        public class RelayCommand : ICommand
            private readonly Action _execute;
            private readonly Func<bool> _canExecute;
            /// <summary>
            /// Raised when RaiseCanExecuteChanged is called.
            /// </summary>
            public event EventHandler CanExecuteChanged;
            /// <summary>
            /// Creates a new command that can always execute.
            /// </summary>
            /// <param name="execute">The execution logic.</param>
            public RelayCommand(Action execute)
                : this(execute, null)
            /// <summary>
            /// Creates a new command.
            /// </summary>
            /// <param name="execute">The execution logic.</param>
            /// <param name="canExecute">The execution status logic.</param>
            public RelayCommand(Action execute, Func<bool> canExecute)
                if (execute == null)
                    throw new ArgumentNullException("execute");
                _execute = execute;
                _canExecute = canExecute;
            /// <summary>
            /// Determines whether this <see cref="RelayCommand"/> can execute in its current state.
            /// </summary>
            /// <param name="parameter">
            /// Data used by the command. If the command does not require data to be passed, this object can be set to null.
            /// </param>
            /// <returns>true if this command can be executed; otherwise, false.</returns>
            public bool CanExecute(object parameter)
                return _canExecute == null ? true : _canExecute();
            /// <summary>
            /// Executes the <see cref="RelayCommand"/> on the current command target.
            /// </summary>
            /// <param name="parameter">
            /// Data used by the command. If the command does not require data to be passed, this object can be set to null.
            /// </param>
            public void Execute(object parameter)
                _execute();
            /// <summary>
            /// Method used to raise the <see cref="CanExecuteChanged"/> event
            /// to indicate that the return value of the <see cref="CanExecute"/>
            /// method has changed.
            /// </summary>
            public void RaiseCanExecuteChanged()
                var handler = CanExecuteChanged;
                if (handler != null)
                    handler(this, EventArgs.Empty);
    /// ViewModel Base
    class ViewModelBase
            public event PropertyChangedEventHandler PropertyChanged;
            protected virtual void RaisePropertyChanged(string propertyName)
                var handler = this.PropertyChanged;
                if (handler != null)
                    handler(this, new PropertyChangedEventArgs(propertyName));
    ///MainPageViewModel
    class MainPageViewModel : ViewModelBase
            #region Properties
            private int id = 0;
            public int Id
                get
                { return id; }
                set
                    if (id == value)
                    { return; }
                    id = value;
                    RaisePropertyChanged("Id");
            private string name = string.Empty;
            public string Name
                get
                { return name; }
                set
                    if (name == value)
                    { return; }
                    name = value;
                    isDirty = true;
                    RaisePropertyChanged("Name");
            private string city = string.Empty;
            public string City
                get
                { return city; }
                set
                    if (city == value)
                    { return; }
                    city = value;
                    isDirty = true;
                    RaisePropertyChanged("City");
            private string contact = string.Empty;
            public string Contact
                get
                { return contact; }
                set
                    if (contact == value)
                    { return; }
                    contact = value;
                    isDirty = true;
                    RaisePropertyChanged("Contact");
            private bool isDirty = false;
            public bool IsDirty
                get
                    return isDirty;
                set
                    isDirty = value;
                    RaisePropertyChanged("IsDirty");
            #endregion "Properties"
            public ObservableCollection<Customer> _customerlist { get; set; }
     public Person CustomerToAdd { get; set; }
            /// <summary>
            /// Add Customer data to the table
            /// </summary>
            public RelayCommand AddCusomerCommand { get; set; }
            private void addCustomer()
            /// <summary>
            /// Delete Selected Customer data from the table
            /// </summary>
            public RelayCommand DeleteSelectedCustomerCommand { get; set; }
            private void deleteSelectedCustomer()
            /// <summary>
            /// edit Selected Customer data from the table
            /// </summary>
            public RelayCommand EditSelectedCustomerCommand { get; set; }
            private void editSelectedCustomer()
            /// <summary>
            /// Delete All Customer data from the table
            /// </summary>
            public RelayCommand DeleteAllCustomerCommand { get; set; }
            private void deleteAll()
            public MainPageViewModel()
                AddCusomerCommand = new RelayCommand(addCustomer);
                DeleteAllCustomerCommand = new RelayCommand(deleteAll);
                EditSelectedCustomerCommand = new RelayCommand(editSelectedCustomer);
                DeleteSelectedCustomerCommand = new RelayCommand(deleteSelectedCustomer);
    /////////// App.Xaml.Cs
    sealed partial class App : Application
            /// <summary>
            /// Initializes the singleton application object.  This is the first line of authored code
            /// executed, and as such is the logical equivalent of main() or WinMain().
            /// </summary>
            public App()
                this.InitializeComponent();
                this.Suspending += OnSuspending;
            /// <summary>
            /// Invoked when the application is launched normally by the end user.  Other entry points
            /// will be used such as when the application is launched to open a specific file.
            /// </summary>
            /// <param name="e">Details about the launch request and process.</param>
            protected override void OnLaunched(LaunchActivatedEventArgs e)
    #if DEBUG
                if (System.Diagnostics.Debugger.IsAttached)
                    this.DebugSettings.EnableFrameRateCounter = true;
    #endif
                Frame rootFrame = Window.Current.Content as Frame;
                // Do not repeat app initialization when the Window already has content,
                // just ensure that the window is active
                if (rootFrame == null)
                    // Create a Frame to act as the navigation context and navigate to the first page
                    rootFrame = new Frame();
                    // Set the default language
                    rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
                    rootFrame.NavigationFailed += OnNavigationFailed;
                    if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                        //TODO: Load state from previously suspended application
                    // Place the frame in the current Window
                    Window.Current.Content = rootFrame;
                var dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,"data.db3");
                using (var db = new SQLite.SQLiteConnection(dbpath))
                    // Create the tables if they don't exist
                    db.CreateTable<Customer>();
                    db.Commit();
                    db.Dispose();
                    db.Close();
                if (rootFrame.Content == null)
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    rootFrame.Navigate(typeof(MVVM.Views.Page1), e.Arguments);
                // Ensure the current window is active
                Window.Current.Activate();
            /// <summary>
            /// Invoked when Navigation to a certain page fails
            /// </summary>
            /// <param name="sender">The Frame which failed navigation</param>
            /// <param name="e">Details about the navigation failure</param>
            void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
                throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
            /// <summary>
            /// Invoked when application execution is being suspended.  Application state is saved
            /// without knowing whether the application will be terminated or resumed with the contents
            /// of memory still intact.
            /// </summary>
            /// <param name="sender">The source of the suspend request.</param>
            /// <param name="e">Details about the suspend request.</param>
            private void OnSuspending(object sender, SuspendingEventArgs e)
                var deferral = e.SuspendingOperation.GetDeferral();
                //TODO: Save application state and stop any background activity
                deferral.Complete();
    /// xaml Code
    <Page.DataContext>
            <ViewModels:MainPageViewModel>
            </ViewModels:MainPageViewModel>
        </Page.DataContext>
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <ListView ItemsSource="{Binding _customerlist}"
                      HorizontalAlignment="Left" Margin="44,65,0,327" Width="456">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Width="400" Background="Chocolate">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Text="{Binding Name}" FontSize="30" />
                                <TextBlock Text="," FontSize="30" />
                                <TextBlock Text="{Binding City }" FontSize="30" />
                            </StackPanel>
                            <TextBlock Text="{Binding Contact}" FontSize="30" />
                        </StackPanel>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
            <Button Command="{Binding  AddCustomerCommand}"
              Content="Add person"
              FontSize="40" Margin="588,465,0,230"/>
            <Button Command="{Binding EditSelectedCustomerCommand}"
              Content="Edit"
              FontSize="40" Margin="865,465,0,230"/>
            <Button Command="{Binding DeleteSelectedCustomerCommand}"
                    Content="Delete"
                    FontSize="40" Margin="1037,465,0,230" />
            <Button Command="{Binding DeleteAllCustomerCommand }"
                    Content="Delete All"
                    FontSize="40" Margin="979,619,0,76" />
            <TextBlock Text="Name" FontSize="30" Margin="633,65,598,640" Height="63"/>
            <TextBox DataContext="{Binding PersonToAdd}" Text="{Binding Name, Mode=TwoWay}"
                     FontSize="30" Margin="868,62,80,640"/>
            <TextBlock Text="City " FontSize="30" Margin="633,181,551,524"/>
            <TextBox DataContext="{Binding PersonToAdd}" Text="{Binding City, Mode=TwoWay}"
                     FontSize="30" Margin="868,181,80,525"/>
            <TextBlock Text="Age" FontSize="30" Margin="633,296,536,400"/>
            <TextBox DataContext="{Binding PersonToAdd}" Text="{Binding Contact, Mode=TwoWay}"
                     FontSize="30" Margin="868,296,80,403"/>
        </Grid>

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf
    The above fourm use MVVM and they can help you there.

  • How to add byte[] array based Image to the SQL Server without using parameter

    how to add byte[] array based Image to the SQL Server without using parameter.I have a column in table with the type image in sql and i want to add image array to the sql image column like below:
    I want to add image (RESIM) to the procedur like shown above but sql accepts byte[] RESIMI like System.Drowing. I whant that  sql accepts byte [] array like sql  image type
    not using cmd.ParametersAdd() method
    here is Isle() method content

    SQL Server binary constants use a hexadecimal format:
    https://msdn.microsoft.com/en-us/library/ms179899.aspx
    You'll have to build that string from a byte array yourself:
    byte[] bytes = ...
    StringBuilder builder = new StringBuilder("0x", 2 + bytes.Length * 2);
    foreach (var b in bytes)
    builder.Append(b.ToString("X2"));
    string binhex = builder.ToString();
    That said, what you're trying to do - not using parameters - is the wrong thing to do. Not only it is insecure due to the risk of SQL injection but in the case of binary data is also inefficient since these hex strings are larger than the original byte[]
    data.

  • How to add a parameter to sql query in report

    Hi
    How to add a parameter to sql query in report.
    Parameter is from Visual studio
    example:
    select * from tab1 where dl=parameter???
    I have VS 2008 prof CR XI R2, mysql

    Hello,
    If you have this API available then you can modify the record selection formulae in code to add filtering:
              string recordSelectionFormula = "{T_INV_RPT_ADDR.IND_PROMUS} = {?P_PROMUS?} AND {T_INV_RPT_POINT.INVOICE_DATE} = DATE(2008, 05, 31) AND {T_INV_RPT_POINT.CHECKOUT_DATE} = date(2008, 04,29)";
                CrystalDecisions.CrystalReports.Engine.ReportDocument.RecordSelectionFormula = recordSelectionFormula;
    You have to format and follow the rules as in the Designer so not too much work to get this to work.
    CR for .NET may not have the ability so you will need to upgrade to a Developer version of Crystal Reports.
    Thank you
    Don

  • How to secure connection in sql server 2008? my main problem is which certificate should i add in mmc

    i'm recently working on hardening of sql server 2008. now i face with a problem. my problem is  how to secure connection in sql server 2008?  my main problem is which certificate should i add in mmc? what are these certificates about?and guide
    me in choosing the appropriate certificate.
    and how should i know that the connection in sql server is secured?
    plz guide me from the beginning cause i'm rookie in this subject.
    thanks in advance.

    Hi sqlfan,
    Question 1: my problem is how to secure connection in sql server 2008?
    Microsoft SQL Server can use Secure Sockets Layer (SSL) to encrypt data that is transmitted across a network between an instance of SQL Server and a client application. For more information about Encrypting Connections to SQL Server, please refer to the following
    article:
    http://technet.microsoft.com/en-us/library/ms189067(v=sql.105).aspx
    Question 2: my main problem is which certificate should i add in mmc? what are these certificates about?and guide me in choosing the appropriate certificate.
    To install a certificate in the Windows certificate store of the server computer, you will need to purchase/provision a certificate from a certificate authority first. So please go to a certificate authority to choose the appropriate certificate.
    For SQL Server to load a SSL certificate, the certificate must meet the following conditions:
    The certificate must be in either the local computer certificate store or the current user certificate store.
    The current system time must be after the Valid from property of the certificate and before the Valid to property of the certificate.
    The certificate must be meant for server authentication. This requires the Enhanced Key Usage property of the certificate to specify Server Authentication (1.3.6.1.5.5.7.3.1).
    The certificate must be created by using the KeySpec option of AT_KEYEXCHANGE. Usually, the certificate's key usage property (KEY_USAGE) will also include key encipherment (CERT_KEY_ENCIPHERMENT_KEY_USAGE).
    The Subject property of the certificate must indicate that the common name (CN) is the same as the host name or fully qualified domain name (FQDN) of the server computer. If SQL Server is running on a failover cluster, the common name must match the host
    name or FQDN of the virtual server and the certificates must be provisioned on all nodes in the failover cluster.
    Question 3: how should i know that the connection in sql server is secured?
    If the certificate is configured to be used, and the value of the ForceEncryption option is set to Yes, all data transmitted across a network between SQL Server and the client application will be encrypted using the certificate. For more detail about this,
    please refer to Configuring SSL for SQL Server in the following article:
    http://technet.microsoft.com/en-us/library/ms189067(v=sql.105).aspx
    If you have any question, please feel free to let me know.
    Regards,
    Donghui Li

  • How to add Two Columns in SQL

    How to add Two Columns in SQL
    For Example
    Jan Feb
    215 NULL
    How to add these two values in SQL

    Anything + NULL is NULL.
    Check this:
    SQL> SELECT 1 + NULL from dual;
        1+NULL
    SQL> You have to do this:
    SQL> with t as (SELECT 235 JAN, NULL FEB FROM dual)
      2  SELECT NVL(JAN,0) + NVL(FEB,0) FROM t;
    NVL(JAN,0)+NVL(FEB,0)
                      235
    SQL>

  • How to add custom sql operations in Database adapters?

    I have a database adapter in ESB configured with insert, update and select operations.
    I wanted to add another select operation with pure sql. When I added the operation it gave me error "Start of the root element expected" while registering the service.
    Can't we do like this?
    I use SOA suite 10.1.3.4.
    - Sam

    Hi Thanks for reply.
    There is an option while configuring the DB adapter "Execute Custom SQL" where you can specify the query you want to execute. It will generate the schema as per the query you enter in the wizard.
    I have created adapters with this type of custom SQLs and even I have put multiple operations in the same adapters where all use Custom SQL and they are working fine.
    Thease custom SQL operations can be anything insert, update, select and they even work with other operations using procedures in the same adapter. But yes we need to modify the WSDL manuallly.
    My problem was that when I try to add the custom SQL operation in the adapter which is configured with normal select, insert and update operation, I was getting the error mentioned.
    - Sam

  • How to add records or how to maintain list in stored Procedure

    Hi,
    I am facing an issue in the addition of record in the type
    create or replace
    TYPE               "PROD_SEARCH_COUNT_TBL"                                          AS TABLE OF PROD_SEARCH_COUNT_OBJ;
    create or replace
    TYPE               "PROD_SEARCH_COUNT_OBJ"                                          AS OBJECT
    ( /* TODO enter attribute and method declarations here */
        V_Name Varchar2(500 Byte),
        v_Value Varchar2(500 Byte),
        v_count Number
    I want to add records to the type I tried following way
    prod_wcf_rec PROD_SEARCH_COUNT_TBL;
      SELECT PROD_SEARCH_COUNT_OBJ('Name1','Value1',1) BULK COLLECT INTO prod_wcf_rec FROM DUAL;
        SELECT PROD_SEARCH_COUNT_OBJ('Name2','Value2',2) BULK COLLECT INTO prod_wcf_rec FROM DUAL;
        SELECT PROD_SEARCH_COUNT_OBJ('Name3','Value3',3) BULK COLLECT INTO prod_wcf_rec FROM DUAL;
        SELECT PROD_SEARCH_COUNT_OBJ('Name4','Value4',4) BULK COLLECT INTO PROD_WCF_REC FROM DUAL;
    DBMS_OUTPUT.PUT_LINE ('-----------------------------Looping----------------------------');
    FOR i in 1 .. prod_wcf_rec.COUNT
    LOOP         
    DBMS_OUTPUT.PUT_LINE (prod_wcf_rec(i).V_Name||' - '||prod_wcf_rec(i).v_Value||' - '||prod_wcf_rec(i).v_count);     
       END LOOP;
       DBMS_OUTPUT.PUT_LINE ('-----------------------------Looping----------------------------');
    In printing I am getting last records only .So is there any way to add records to PROD_SEARCH_COUNT_TBL
    How to add records or how to maintain list in stored Procedure

    Every time you BULK COLLECT into a collection type the value is overwirtten. So you need to try something like this.
    SQL> create or replace type prod_search_count_obj as object(v_name varchar2(500 byte), v_value varchar2(500 byte), v_count number)
      2  /
    Type created.
    SQL> create or replace type prod_search_count_tbl as table of prod_search_count_obj
      2  /
    Type created.
    SQL> declare
      2    prod_wcf_rec prod_search_count_tbl;
      3  begin
      4    select obj_val
      5      bulk collect into prod_wcf_rec
      6      from (
      7            select prod_search_count_obj('name1','value1',1) obj_val from dual
      8            union all
      9            select prod_search_count_obj('name2','value2',2) from dual
    10            union all
    11            select prod_search_count_obj('name3','value3',3) from dual
    12            union all
    13            select prod_search_count_obj('name4','value4',4) from dual
    14           );
    15
    16    dbms_output.put_line ('-----------------------------looping----------------------------');
    17    for i in 1 .. prod_wcf_rec.count
    18    loop
    19      dbms_output.put_line (prod_wcf_rec(i).v_name||' - '||prod_wcf_rec(i).v_value||' - '||prod_wcf_rec(i).v_count);
    20    end loop;
    21    dbms_output.put_line ('-----------------------------looping----------------------------');
    22  end;
    23  /
    -----------------------------looping----------------------------
    name1 - value1 - 1
    name2 - value2 - 2
    name3 - value3 - 3
    name4 - value4 - 4
    -----------------------------looping----------------------------
    PL/SQL procedure successfully completed.
    SQL>

  • How to add entire new row at the top of table in pdf report from c# windows forms using iTextSharp

    Hi for past 3 days i was thinking and breaking my head on how to add entire new at top table created in pdf report from c# windows forms with iTextSharp.
    First: I was able to create/export sql server data in form of table in pdf report from c# windows forms. Given below is the code in c#.
    using System;
    using System.Collections.Generic;
    using System.Configuration;
    using System.Text;
    using System.Data;
    using System.IO;
    using System.Data.SqlClient;
    using System.Windows.Forms;
    using iTextSharp.text;
    using iTextSharp.text.pdf;
    namespace DRRS_CSharp
    public partial class frmPDFTechnician : Form
    public frmPDFTechnician()
    InitializeComponent();
    private void btnExport_Click(object sender, EventArgs e)
    Document doc = new Document(PageSize.A4.Rotate());
    var writer= PdfWriter.GetInstance(doc, new FileStream("Technician22.pdf", FileMode.Create));
    doc.SetMargins(50, 50, 50, 50);
    doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
    doc.Open();
    PdfPTable table = new PdfPTable(7);
    table.TotalWidth=585f;
    table.LockedWidth = true;
    PdfPTable inner = new PdfPTable(1);
    inner.WidthPercentage = 115;
    PdfPCell celt=new PdfPCell(new Phrase(new Paragraph("Institute/Hospital:AIIMS,NEW DELHI",FontFactory.GetFont("Arial",14,iTextSharp.text.Font.BOLD,BaseColor.BLACK))));
    inner.AddCell(celt);
    Paragraph para = new Paragraph("DCS Clinical Report-Technician wise", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK));
    para.Alignment = iTextSharp.text.Element.TITLE;
    iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
    png.ScaleToFit(95f, 95f);
    png.Alignment = Element.ALIGN_RIGHT;
    SqlConnection conn=new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
    SqlCommand cmd = new SqlCommand("Select t.technician_id,td.Technician_first_name,td.Technician_middle_name,td.Technician_last_name,t.technician_dob,t.technician_sex,td.technician_type from Techniciandetail td,Technician t where td.technician_id=t.technician_id and td.status=1", conn);
    conn.Open();
    SqlDataReader dr;
    dr = cmd.ExecuteReader();
    table.AddCell("ID");
    table.AddCell("First Name");
    table.AddCell("Middle Name");
    table.AddCell("Last Name");
    table.AddCell("DOB" );
    table.AddCell("Gender");
    table.AddCell("Designation");
    while (dr.Read())
    table.AddCell(dr[0].ToString());
    table.AddCell(dr[1].ToString());
    table.AddCell(dr[2].ToString());
    table.AddCell(dr[3].ToString());
    table.AddCell(dr[4].ToString());
    table.AddCell(dr[5].ToString());
    table.AddCell(dr[6].ToString());
    dr.Close();
    table.SpacingBefore = 15f;
    doc.Add(para);
    doc.Add(png);
    doc.Add(inner);
    doc.Add(table);
    doc.Close();
    The code executes well with no problem and get all datas from tables into table in PDF report from c# windows forms.
    But here is my problem how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
    As the problem i am facing is my title or Header(DCS Clinical Report-Technician wise) is at top of my image named:logo5.png and not coming to it's center position of my image.
    Second the problem i am facing is how to add new entire row to top of existing table in pdf report from c# windows form using iTextSharp?.
    given in below is the row and it's data . So how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
    as you can see how i create my columns in table in pdf report and populate it with sql server data. Given the code below:
    Document doc = new Document(PageSize.A4.Rotate());
    var writer= PdfWriter.GetInstance(doc, new FileStream("Technician22.pdf", FileMode.Create));
    doc.SetMargins(50, 50, 50, 50);
    doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
    doc.Open();
    PdfPTable table = new PdfPTable(7);
    table.TotalWidth=585f;
    table.LockedWidth = true;
    Paragraph para = new Paragraph("DCS Clinical Report-Technician wise", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK));
    para.Alignment = iTextSharp.text.Element.TITLE;
    iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
    png.ScaleToFit(95f, 95f);
    png.Alignment = Element.ALIGN_RIGHT;
    SqlConnection conn=new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
    SqlCommand cmd = new SqlCommand("Select t.technician_id,td.Technician_first_name,td.Technician_middle_name,td.Technician_last_name,t.technician_dob,t.technician_sex,td.technician_type from Techniciandetail td,Technician t where td.technician_id=t.technician_id and td.status=1", conn);
    conn.Open();
    SqlDataReader dr;
    dr = cmd.ExecuteReader();
    table.AddCell("ID");
    table.AddCell("First Name");
    table.AddCell("Middle Name");
    table.AddCell("Last Name");
    table.AddCell("DOB" );
    table.AddCell("Gender");
    table.AddCell("Designation");
    while (dr.Read())
    table.AddCell(dr[0].ToString());
    table.AddCell(dr[1].ToString());
    table.AddCell(dr[2].ToString());
    table.AddCell(dr[3].ToString());
    table.AddCell(dr[4].ToString());
    table.AddCell(dr[5].ToString());
    table.AddCell(dr[6].ToString());
    dr.Close();
    table.SpacingBefore = 15f;
    doc.Add(para);
    doc.Add(png);
    doc.Add(table);
    doc.Close();
    So my question is how to make my column headers in bold?
    So these are my questions.
    1. how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
    2. how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
    3.how to make my column headers in bold?
    I know that i have to do some modifications to my code but i dont know how to do it. Can anyone help me please.
    Any help or guidance in solving this problem would be greatly appreciated.
    vishal

    Hi,
    >>1. how can i align Title(DCS Clinical Report-Technician wise) center of pdf report with image named:logo5.png immediately coming to it's right?.
    2. how do i add the given below row and it's data to my top my table in pdf report from c# windows forms using itextsharp?
    3.how to make my column headers in bold?<<
    I’m sorry for the issue that you are hitting now.
    This itextsharp is third party control, for this issue, I recommended to consult the control provider directly, I think they can give more precise troubleshooting.
    http://sourceforge.net/projects/itextsharp/
    Thanks for your understanding.
    Regards,
    Marvin
    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.

  • How can I use TopLink for querys that have two and more tables?

    I use TopLink today, and I can use one table to query, but how can I use TopLink for querys that have two and more tables?
    Thank you for see and answer this question.

    You can write a custom SQL query and map it to an object as needed. You can also use the Toplink query language "anyOf" or "get" commands to map two tables as long as you map them as one to one (get command) or one to many (anyOf command) in the toplink mapping workbench.
    Zev.
    check out oracle.toplink.expressions.Expression in the 10.1.3 API

Maybe you are looking for

  • ABAP Command in Transformation routine

    Hi   I had a Internal Table used in Lookup of a Transformation which is being populated from a Active Table of DSO.   The Internal table has about 5 fields.   My requirment is to check the data in the IT Stable after the select statement and Replace

  • How to edit text in  text boxes in psd format documents?

    A colleague has produced a flier using Publisher and has sent me psd file.  I would like to edit and change some of the text within existing text boxes. How do I do that? I look forward to hearing Regards GMcG

  • Can't make static reference to method

    hi all, pls help me in the code i'm getting " can't make static reference to method....." kindly help me the following code gives the error: import java.rmi.*; import java.rmi.Naming; import java.rmi.RemoteException; import java.io.*; import java.io.

  • Best practices for cleaning up after a Bulk REST API v2 export

    I want to make sure that I am cleaning up after my exports (not leaving anything staging, etc). So far I am DELETEing $ENTITY/exports/$ID and $ENTITY/exports/$ID/data as described in the Bulk REST API documentation Using a dataRetentionDuration when

  • Sorry for error in Darren McNally's name

    I spell checked my original message about being able to flash 9, but did not catch the error in Mr. McNally's name. I highly recommend to those who are still having install problems to follow his instructions about Download Center problems. Just be s