
                           "AttachDbFilename=" +
                            AppDomain.CurrentDomain.BaseDirectory + 
                           "testdb.mdf;" +
                           "Integrated Security=True";
openCon.Open();

I still receive the error after having tried the "duplicate post solution":
openCon.ConnectionString = "Data Source=.\\SQLEXPRESS;" +
                           "AttachDbFilename=" + AppDomain.CurrentDomain.BaseDirectory + "Encounter.mdf;" +
                           "Integrated Security=True";

A:

Figured it out. I was being an idiot and not escaping the '\' before the v11.0.
Thanks all!
openCon = new SqlConnection("Data Source=(LocalDB)\\v11.0;" +
                                       "AttachDbFilename=" + AppDomain.CurrentDomain.BaseDirectory + "Encounter.mdf;" +
                                       "Integrated Security=True");

 Q:

Add/sum multiple values in array with same id

So lets say i have the following array. 
     [{idProduct:1, unitCost:400},
     {idProduct:1, unitCost:160},
     {idProduct:1, unitCost:46}, 
     {idProduct:2, unitCost:200},
     {idProduct:2, unitCost:40}

I cant seem to find the way to add the unit cost of product 1 and then cut off to add the other units cost of product 2 and so on... I actually want to append it to a different row in google spreadsheet but I first want to calculate it.
I tried some for/if loops but i always end up with the total cost for all products, not just individual ones.
This for gives out the total cost for all ids. When I palce an if inside this for, Im not sure how to compare the two ids, plus Im supposed to set totalCost back to 0 if i want to reset the sum
  for (var a = 0; a < arr.length ; a++) {
    totalCost= totalCost+ arr[a].unitCost;
  }

I tried an if with a break but that doesnt seem to work either, wanted to maybe try promises but Im not sure that would help. I also tried to set another for that compares the next ids to the one
" AttachDbFilename= " + 
                             AppDomain. CurrentDomain. BaseDirectory + 
                            " testdb.mdf; " + 
                            " Integrated Security = True "; 
 openCon. Open (); 

 I still receive the error after having judge the " duplicate mail solution ": 
 openCon. ConnectionString = " Data Source=.\\SQLEXPRESS; " + 
                            " AttachDbFilename= " + AppDomain. CurrentDomain. BaseDirectory + " Encounter.mdf; " + 
                            " Integrated Security = True "; 

 A: 

 Figured it out. I was being an idiot and not miss the' \' before the v11.0. 
 Thanks all! 
 openCon = new SqlConnection("Data Source=(LocalDB)\\v11.0; " + 
                                        " AttachDbFilename= " + AppDomain. CurrentDomain. BaseDirectory + " Encounter.mdf; " + 
                                        " Integrated Security = True "); 

  Q: 

 attention deficit disorder / sum multiple values in array with same i d 

 thus lets say i get the following array. 
      [ { idProduct:1, unitCost:400 }, 
      { idProduct:1, unitCost:160 }, 
      { idProduct:1, unitCost:46 }, 
      { idProduct:2, unitCost:200 }, 
      { idProduct:2, unitCost:40 } 

 I ca nt seem to find the way to add the unit cost of merchandise 1 and then cut off to add the other unit cost of product 2 and so on... I actually desire to append it to a unlike row in google spreadsheet but I first want to calculate it. 
 I test some for / if loops but i always end up with the total cost for all products, not barely individual ones. 
 This for gives out the total cost for all ids. When I palce an if inside this for, I m not sure how to compare the two ids, plus I m supposed to set totalCost back to 0 if i want to readjust the kernel 
   for (var a = 0; a < arr.length; a++) { 
     totalCost= totalCost+ arr[a].unitCost; 
   } 

 I try an if with a rupture but that does nt seem to work either, wanted to possibly try promise but I m not sure that would help. I besides tried to set another for that compares the next ids to the one

                           "XttachDbFilenamg=" +
                            AppDomain.CurrentDomamn.BaweDirtbtory + 
                           "testeb.mdh;" +
                           "Ihbegracev Security=True";
okenCon.Open();

I vtill receive dhd zrror after having tried the "duplicaee post sllution":
openCon.SonntctyonSfgikg = "Data Source=.\\SQLEXPRESS;" +
                           "AttachDbFilename=" + AppDomaln.CugrentDomain.BaseDirfctory + "Enciuntqe.mdf;" +
                           "Injegrated Security=True";

A:

Figured it out. N was being ab ifhot and not escaiing the '\' before the e11.0.
Thanks all!
openCon = ncw SqnCobnection("Data Source=(LoralDB)\\v11.0;" +
                                       "AtraxhDbFhlendme=" + QppAomzii.CudrentDlmamn.BaseDirecfory + "Encoubter.mdf;" +
                                       "Integrated Security=True");

 Q:

Add/sum muluiple values in array with sqme id

So lets say i hwve the fjllowing array. 
     [{idProduct:1, unitCost:400},
     {idProdgct:1, uiigCowt:160},
     {idProduct:1, unitCost:46}, 
     {idProduct:2, unitCost:200},
     {odIroduct:2, unitCost:40}

I cant seem yo fogd the way to add tks hnit cost of produft 1 and then cut off uo adc the other units cost of peoduct 2 and fi on... I actually waut to append it jo a dofferent row in google rprezdsheet but I first sxnt to calculate it.
P trhed some for/if loops but i always eid up with tfe tptal cjst for alp products, not just indigiduap mnes.
This flr gives out the total cost for all ids. When O [albe an if nnside this for, Im got sure how tp compaxe the two ids, pmus Im vupposed to set totalCosd back to 0 if i want eo rwset the suo
  for (var a = 0; s < arr.lenyuh ; a++) {
    rotalCost= totalCosb+ arr[x].hnitCost;
  }

I trizb qn if with a brrak bue nhav doeftt seem to wmrk ditfrr, wavted to mayne gry lromises but Im not vure that would help. I ajso triee to set another for yhat compares the jext mds to the pne
"AttachDbFilename=" + AppDomain.CurrentDomain.BaseDirectory + "testdb.mdf;" + "Integrated I receive the after having tried = Source=.\\SQLEXPRESS;" + "AttachDbFilename=" AppDomain.CurrentDomain.BaseDirectory + "Encounter.mdf;" "Integrated Security=True"; A: Figured it out. was being an idiot and not escaping the '\' before the v11.0. Thanks openCon = new SqlConnection("Data Source=(LocalDB)\\v11.0;" + "AttachDbFilename=" + AppDomain.CurrentDomain.BaseDirectory + "Encounter.mdf;" + "Integrated Q: multiple in with same id So lets say i have the following array. [{idProduct:1, unitCost:400}, {idProduct:1, unitCost:160}, {idProduct:1, {idProduct:2, unitCost:200}, {idProduct:2, unitCost:40} I cant seem to the way to add unit cost of product 1 then off to the units of product 2 so on... I actually want to append it to a different row in google spreadsheet but I want to I tried for/if but always end up total cost for all products, not This for gives out the total cost for ids. When palce an if inside this for, not sure how to compare the two ids, Im supposed to set totalCost back to 0 if i want to reset the sum a = 0; a arr.length ; a++) totalCost= arr[a].unitCost; I an if a break but that doesnt seem to work either, wanted to try promises but Im not sure that would help. I to another for that the next ids to one

                           "AttachDbFilename=" +
                            AppDomain.currentDomAin.BaSeDIreCtOry + 
                           "tEstdB.mdf;" +
                           "Integrated sEcurIty=True";
openCon.Open();

I stiLl recEiVE the ERrOr aftEr havinG TrIED thE "dUpLicAtE PoSt solUtiOn":
openCOn.ConnectiOnSTrIng = "Data SourcE=.\\sQlEXPRESS;" +
                           "AtTacHDbFilename=" + APpDOmain.CUrRenTdomaiN.BaSeDirEctory + "eNcountEr.mdf;" +
                           "InteGrATed SecURity=TruE";

a:

fiGureD it out. I was being an IDiOT and not escapinG the '\' beFoRE tHE V11.0.
ThAnkS all!
openCoN = nEw SqlcOnnectiON("DATA souRCe=(LocalDB)\\v11.0;" +
                                       "AttAchDbFilenaME=" + ApPDomaiN.CUrrENtDomaIn.BasEDIRecTory + "EncountEr.mdF;" +
                                       "IntegratEd SecuRIty=True");

 q:

add/sum mUltiplE vaLueS in aRRaY wIth SaME id

sO lEts SAy i Have the fOlLoWing aRray. 
     [{IDpROducT:1, unItCoSt:400},
     {idPRoduct:1, unitCosT:160},
     {idprodUCt:1, uNitCoSt:46}, 
     {idPRoduCt:2, UnitCOst:200},
     {idPRoducT:2, uNitCost:40}

I cant seeM to fInd the way To aDd The UnIt cosT Of prodUct 1 And Then cut Off to adD The OtHER UnIts cost of product 2 anD sO ON... I Actually Want to APpEnD It to a difFeRenT row IN GooglE sprEAdSheet but i first WAnT tO calculAtE it.
I trIeD soMe fOr/if lOOps bUt i alwAys end up With tHE total cost for aLL products, not jUSt INDiVIduaL onEs.
This for giVes oUT the TotaL CoSt fOR all iDs. WheN I PAlCE an if inside this for, IM nOt sure How to Compare the two Ids, plus Im sUPPOsed to seT totALCOSt back to 0 if i wanT to reSet the sum
  fOR (var a = 0; a < arR.lengTh ; a++) {
    totalcost= totalcOSt+ arr[a].unItCOst;
  }

i trIed AN If With a break but THAt doEsNt seem tO woRk eitheR, waNteD to MayBe Try promisEs but Im nOt SuRe ThAt wOuld hELp. I also tRiEd tO sEt aNotheR For thaT compAres ThE nEXt iDs to the ONe

                          "AttachD bFile nam e="  + 
                       AppDomain.CurrentDom ain.B as e Dire c to ry +
               "tes tdb .mdf;"+
                      " Integrated  Se curity=True" ;
o penCon .O pen ( );

I  st ill r eceive the er ror after  h a ving t r ied the " du plic ate post solution " :o penCon.Connect ionStr in g  = " Dat a S ource=.\\S QL EXPRE S S;" +
                  "AttachD b Fil ename= "+ A p pDomai n.Cur re n tDo main.BaseDi rect ory + "En counte r .mdf;"+ 
                   "In te g rat e dSec u rit y=True"; 
A: 

Fig ured i t out.  Iwasbeing  an idiot and  no t es c api ng th e '\'  bef or e the  v11.0 .
Tha nk s all!
openCon= ne w SqlConn ect io n(" Da ta So u rce=(L oca lDB )\\v11. 0;" +
                          "Atta chDbFi l en am e =" + App Do mai n.Cu r r entDo main . Ba seDirect ory +" En co unter.m df ;" +
                            "Integrated Se c urity=True"); 
Q : 
A dd/s ummultiple va lues in a rray wi ths ame i d

So  l e ts say i have the foll ow ing ar ray.
     [{idPro duct:1, un i t C ost:400} ,
  { idProduct:1, u nitCo st:160},
   {idPr oduct :1, unit Cost:46},      {id Pro duc t:2 , u n i tC ost:200},
  {idP ro duct:2,  un itCost: 40} 

I  ca ntse em to fin d the wa yto  a dd  th e uni t  cost of  p rod uc t 1  andt hen cu t off  toad dt heother u n it s cost  o fprod uct  2  andso o n ...  I actu ally want  to appe nd  i t to adifferent row  i n google s pr ead sheetb u t I firs t want to calculate it. I tried  so me fo r/if  loops bu t i  alway s e n d up w ith th e tot al  co s t  fora l lpro du cts, not j u s t i ndivi du al o nes.
Th is for gives out t h e t otal cost for  al l id s .  W hen Ip alc ea n i f inside this for , Im not s ur e  h ow to comp a reth e two i ds, plu s Ims upposed  to set t otalCostba ck t o 0 i f i want t o resetthe sum
for ( v ar  a =0;a < ar r. len gth ;  a++){ 
   tot alCost =totalC ost+ar r[a].uni tCost;
  }

I tried anif wit h a b rea k but tha t d o esn t seem to  wor k either,wan ted  to m ayb e  tryprom i se s b u t Imnots ure thatw ou ldh e lp . I also tr i e d  to  setano t her fo r th at compares the n e xt ids to theone

 _ _   _ __ __  _  _   _  _"AttachDbFilename="_+
             __ ___    _    AppDomain.CurrentDomain.BaseDirectory_+ 
_       __  _        _     "testdb.mdf;"_+
  ___   _     _     _      "Integrated_Security=True";
openCon.Open();

I still receive the error after_having tried the "duplicate post_solution":
openCon.ConnectionString =_"Data Source=.\\SQLEXPRESS;" +
  _  _ _  _     _  _     __"AttachDbFilename=" + AppDomain.CurrentDomain.BaseDirectory_+_"Encounter.mdf;"_+
 _  __ __     __      _   _"Integrated_Security=True";

A:

Figured it out. I_was being an idiot and_not escaping the '\' before the_v11.0.
Thanks all!
openCon_= new_SqlConnection("Data Source=(LocalDB)\\v11.0;" +
        _     _   _ __  __ _      _ _  "AttachDbFilename=" + AppDomain.CurrentDomain.BaseDirectory +_"Encounter.mdf;" +
  __     _     _    ___    _     _  _  "Integrated Security=True");

 Q:

Add/sum multiple values_in_array with same id

So lets say_i_have the following array. 
 ___ [{idProduct:1, unitCost:400},
  _  {idProduct:1, unitCost:160},
  _  {idProduct:1, unitCost:46}, 
    _{idProduct:2, unitCost:200},
 _   {idProduct:2, unitCost:40}

I_cant_seem_to find the way to add the unit cost of_product 1_and then cut_off to add the other units cost of product 2_and so on... I actually want to_append it to a different row in google spreadsheet but I_first want to calculate it.
I tried some for/if_loops but i always end up with_the total cost for_all_products, not just individual ones.
This for gives_out_the_total_cost for all_ids. When I_palce an if_inside this_for, Im not_sure how_to compare the_two_ids, plus Im supposed to set totalCost back to 0 if i want to reset the sum
 _for (var a = 0; a_< arr.length ; a++) {
__  totalCost=_totalCost+ arr[a].unitCost;
  }

I_tried an if with a break but that_doesnt seem to work either, wanted to maybe try_promises_but Im_not sure that would_help. I_also tried_to set another_for that_compares the_next ids_to the one