Answered .sdf insert ,retrieve array of string elements

  • Wednesday, March 07, 2012 2:08 AM
     
     

    hello,

    iam using .sdf sql compact for my wpf app,  i know how to insert and retrieve data(one string) into this local database but i don't know how to insert fro an array one by one using 'foreach' method ? please help



    please


All Replies

  • Thursday, March 08, 2012 3:52 AM
    Moderator
     
     

    Hi SANTANA,

    I don't fully understand your sentence: but i don't know how to insert fro an array one by one using 'foreach' method?

    Could you please elaborate a little bit more about it? Do you mean to use array as binding source object? Also, which element you want to bind with?

    If you mean to insert array to database, you can try concatenating the foreach statement into the insert syntax.

    Have a nice day,


    Kee Poppy [MSFT]
    MSDN Community Support | Feedback to us


  • Thursday, March 08, 2012 10:08 AM
     
     

    Sorry 

    Actually I have a array of strings (string[] myarray ;) it contain strings

    i need to send all strings (first to last) to a database

    i think

    foreach(string s in myarray)

    {

    myarray[i] // need to save each element in array

     //need to know query to do this operation 

    }

    please help me



    please

  • Friday, March 09, 2012 5:40 AM
    Moderator
     
     Answered

    Check this (SQL database for instance):

            cmd= new SqlCommand ("insert into table1 values('"+s+"')", con);
            cmd.ExecuteNonQuery();

    Have a nice day,


    Kee Poppy [MSFT]
    MSDN Community Support | Feedback to us

    • Marked As Answer by SANTANA GEORGE Friday, March 09, 2012 6:25 AM
    •  
  • Friday, March 09, 2012 5:46 AM
     
     
    Thank You Verymuch Sir

  • Thursday, March 15, 2012 2:20 AM
     
     
    how to increase speed of my horizontal scrollbar ?

    please