@reference0 must be defined error message when creating parameters in for loop before SQL insert query

I need to parameterise the query in the for loop, but VS2013 keeps telling me that @reference0 must be defined.
Any reason why this keeps happening?
var dbConnect = new DbConnect();
var cmd = new MySqlCommand();
dbConnect.OpenConnection();
var query =
"INSERT INTO booking (operator_id, plot_id, postcode, datetime, stops, " +
"mileage, price, passengers, name, note, phone, status, reference) " +
"VALUES (@operator_id, @plot_id, @postcode, @datetime, @stops, " +
"@mileage, @price, @passengers, @name, @note, @phone, @status, @reference);";
for (var i = 0; i < _waypointList.Count; i++)
query +=
@"INSERT INTO waypoint
(booking_id, sequence, address, lat, lng, reference)
VALUES
((select id FROM booking WHERE reference=@reference" + i + @"),
@sequence" + i + @",
@address" + i + @",
@lat" + i + @",
@lng" + i + @",
@reference" + i + ")";
cmd.Parameters.AddWithValue(("@reference" + i), _reference);
cmd.Parameters.AddWithValue(("@sequence" + i), i);
cmd.Parameters.AddWithValue(("@address" + i), _waypointList[i]);
cmd.Parameters.AddWithValue(("@lat" + i), _lat);
cmd.Parameters.AddWithValue(("@lng" + i), _lng);
Console.WriteLine(query);
cmd = new MySqlCommand(query, DbConnect.Connection);
cmd.Parameters.AddWithValue(("@operator_id"), _operatorId);
cmd.Parameters.AddWithValue(("@plot_id"), _plotId);
cmd.Parameters.AddWithValue(("@postcode"), _postcode);
cmd.Parameters.AddWithValue(("@datetime"), _datetime);
cmd.Parameters.AddWithValue(("@stops"), _stops);
cmd.Parameters.AddWithValue(("@mileage"), _mileage);
cmd.Parameters.AddWithValue(("@price"), _price);
cmd.Parameters.AddWithValue(("@passengers"), _passengers);
cmd.Parameters.AddWithValue(("@name"), _name);
cmd.Parameters.AddWithValue(("@note"), _note);
cmd.Parameters.AddWithValue(("@phone"), _phone);
cmd.Parameters.AddWithValue(("@status"), Status);
cmd.Parameters.AddWithValue(("@reference"), _reference);
cmd.ExecuteNonQuery();
dbConnect.CloseConnection();

reason :>
for (var i = 0; i < _waypointList.Count; i++)
query +=
@"INSERT INTO waypoint
(booking_id, sequence, address, lat, lng, reference)
VALUES
((select id FROM booking WHERE reference=@reference" + i + @"),
@sequence" + i + @",
@address" + i + @",
@lat" + i + @",
@lng" + i + @",
@reference" + i + ")";
cmd.Parameters.AddWithValue(("@reference" + i), _reference);
cmd.Parameters.AddWithValue(("@sequence" + i), i);
cmd.Parameters.AddWithValue(("@address" + i), _waypointList[i]);
cmd.Parameters.AddWithValue(("@lat" + i), _lat);
cmd.Parameters.AddWithValue(("@lng" + i), _lng);
Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

Similar Messages

  • Issuing error message when creating a record for infotype

    i have a req in HR
    for the infotype 14 and the subtype 3010, when i'm going to create a record, i need to check some fields in infotype 0002. if check fails, i need to give error message and stop processing...
    how i should do this...
    thanks in advance

    Go to CMOD transaction and create a project with enhancement PBAS0001.Components for PBAS0001 is EXIT_SAPFP50M_001,EXIT_SAPFP50M_002.
    These two exit will contain tw0 includes ZXPADU01,ZXPADU02.ZXPADU01 include will trigger in the PBO of the transaction in create and change mode  and ZXPADU02 will trigger in in create and change mode  .Inside the inculde you can add the following code for different infotype
      CASE innnn-infty.
    0 0 1 4 *************************
        WHEN '0014'.
          PERFORM validate_0014_pai USING tclas
                                            psave
                                            ipsyst
                                            i001p
                                            i503
                                  CHANGING  innnn
                                           show_data_again.
    0 1 4 7 *************************
        WHEN '0147'.

  • How do i solve - cannot access web server - error message when creating a project in 4.5 with PHP

    How do i solve - cannot access web server - error message when creating a project in 4.5 with PHP

    Screenshot of how it looks when i try to show a ms access form inside a iframe:
    http://oi58.tinypic.com/2vj4ish.jpg

  • I'm getting error messages when I download updates for lightroom and flash for the mac. can't figure out how to trouble shoot.

    I'm getting error messages when I download updates for lightroom and flash for the mac. can't figure out how to trouble shoot.

    It sounds as if your browser and some of your apps are not color-managed.  This is pretty typical.  Even IE9 is only partially color-managed.
    You can expect color-managed and non-color-managed applications to show you different things with the same images.  How different will depend upon how different your monitor color profile is from the image's color profile.
    For web publication and most general use, experts usually advise saving images with the sRGB profile.  If such images, saved through the Save for Web & Devices function, look different to you than you expect, it may be that your input images have previously been saved in another color space.
    You should really try to get your head around color-management by reading more on it.  It can seem baffling and it's difficult to understand without some background.  A quick web search turns up many overviews.  Beware, though, even people writing articles sometimes don't fully understand it.
    -Noel

  • Anyone else getting a timed out error message when trying to check for updates via the app store software on a desktop?

    anyone else getting a timed out error message when trying to check for updates via the app store software on a desktop?

    Hi, couple of things to try...
    Anonymous
    Post subject: NSURLErrorDomain error -1100 in OS X 10.8
    If you check for software updates using the App Store in OS X 10.8 and get "NSURLErrorDomain error -1100" the problem may be with your Software Update preferences. This is particularly likely if you were using a custom Apple Software Update server. To solve the problem, quit the App Store, move the following two files (if present) to the trash, restart, and only then rerun App Store updates:
    /Library/Preferences/com.apple.SoftwareUpdate.plist
    /Library/Preferences/com.apple.SoftwareUpdate.plist.lockfile
    http://x704.net/bbs/viewtopic.php?f=12&t=6130
    I was recently trying to upgrade to mountain lion through the app store.  I have unreliable Internet from a cable company whom I will not name, but we all know who they are.  My Internet dropped while downloading the upgrade.  Once I went through the notorious unplug the modem/router and plugged it back in to gain Internet connectivity again, I could not resume. No matter what I did, the app store kept displaying "an error occurred." I am hoping that those with the same issue read this first to save them hours of skimming through the Internet to find a solution.  Here are the steps to take:
    1. Make sure you have reestablished Internet connection
    2. Chances are you got frustrated when you tried to resume/unpause the download and clicked the "X" to the left.  If so, select the "Store" drop-down menu from the App Store and select "View My Account." There should be an option to unhide your purchase.  You know what to do.
    3. There is also an option to  reset all warnings for buying and downloading under "View My Account." Do this, click "Done," sign out of the App Store and quit the App Store.
    4. Open the Preferences in safari and select Privacy.  Select "Remove All Website Data."  Just do it.
    5. Launch the app store and sign in.
    6. Now, if you "Check for Unfinished Downloads" everything works peachy.
    I hope this helps.  Not much I can do for your Internet connection though.
    JonEz15...
    https://discussions.apple.com/thread/4697970?tstart=120

  • Buffering table not up to date error message when creating a Cart

    Hi Folks,
    We are getting a 'Buffering table not up to date' error message when attempting to create a Cart. The error message only happens to the one end user ID only with the others not getting this error, therefore suggesting that my SRM org plan set-up is correct.
    Has anyone come across this previously and what checks are available in the system to resolve this? As mentioned, the attribute check is okay and I have also removed the user ID from the SRM org plan and reassigned again but this has not corrected the problem. We are on SRM 5.
    Thanks. Mike.
    Message:
    Buffering table not up to date
    Method: GET_STRUCTURE_PATHS_UP of program CL_BBP_ES_EMPLOYEE_MYS========CP
    Method: IF_BBP_ES_EMPLOYEE~GET_RL_UNIT_IDS of program CL_BBP_ES_EMPLOYEE_MYS========CP
    Method: IF_BBP_ES_PROFESSIONAL~GET_WORKPLACE_ADDRESS_IDS of program CL_BBP_ES_EMPLOYEE_MYS========CP
    Method: IF_BBP_ES_PROFESSIONAL~GET_WORKPLACE_ADDRESS_ID of program CL_BBP_ES_EMPLOYEE_MYS========CP
    Method: IF_BBP_ES_PROFESSIONAL~GET_WORKPLACE_ADDRESS of program CL_BBP_ES_EMPLOYEE_MYS========CP
    Form: USER_DETAIL_GET of program SAPLBBP_SC_APP
    Form: GLOBAL_FILL of program SAPLBBP_SC_APP
    Form: SC_INIT of program SAPLBBP_SC_APP
    Function: BBP_SC_APP_EVENT_DISPATCHER of program SAPLBBP_SC_APP
    Form: APP_EVENT_HANDLER of program SAPLBBP_SC_UI_ITS
    Edited by: Mike Pallister on Nov 5, 2008 11:44 AM

    Please advise on this problem.  When I try to check the Approval Overview tab for these two shopping carts.
    I got a dump.can anyone help me.
    Information on where terminated
        Termination occurred in the ABAP program "CL_BBP_ES_EMPLOYEE_MYS========CP" -
         in "IF_BBP_ES_EMPLOYEE~GET_RL_UNIT_IDS".
        The main program was "SAPMHTTP ".
        In the source code you have the termination point in line 35
        of the (Include) program "CL_BBP_ES_EMPLOYEE_MYS========CM008".
        The termination is caused because exception "CX_BBP_ES_INTERNAL_ERROR" occurred
         in
        procedure "/SAPSRM/IF_PDO_DO_APV_EXT~GET_AGENT_DETAILS" "(METHOD)", but it was
         neither handled locally nor declared
        in the RAISING clause of its signature.
        The procedure is in program "/SAPSRM/CL_PDO_DO_APV_EXT=====CP "; its source
         code begins in line
        1 of the (Include program "/SAPSRM/CL_PDO_DO_APV_EXT=====CM00E ".

  • Error message when creating new Pantones

    Hi,
    When I create a new pantone  then double click on it in the swatches panel I get the following error message:
    "Cannot  create swatch library. There are no swatches in the file "HARD  DRIVE:Applications:Adobe InDesign CS6: Presets: Swatch  Libraries:PANTONE+ Solid Coated.acb"
    I've checked the folder and the acb file is there so I don't understand why it is not recognising it?
    Thanks

    Hi, I have CS6 , Mac OS X 10.7.5 and for the permissions I took a screenshot of what it says.
    Where is says 'fetching' that usually says 'imac user' when i check permissions on other files, it is my login name.

  • Error message when creating a Master File

    I have finished editing a multicam clip of a graduation ceremony which is an hour and 27 minutes long. Clients are anxiously awaiting the DVDs/BR discs.
    There are six "Rotation" and one "Ribbon" titles and 21 chapter markers in the timeline. None of the chapter markers are placed in a transition.
    I'm using 10.0.8 FCPX and OS 10.6.8.
    I've tried to create Master File in order to use Toast 11 titanium to make a Blu Ray disc but I've had the following message appear twice midway through the process:
    The operation could not be completed because an error occurred when creating frame 152526 (error -1).
    Any suggestions as to what I might do to resolve this will be greatly appreciated. Or is there is another method to create a Blu Ray disc, I'd appreciate info.
    Thanks,
    Gary

    Go to Preferences and turn off Background Rendering.
    Select your project in the library and in the File menu, click on Delete project Render Files; choose All when prompted. Select your event and do the same with the event Render files. In the project use the range tool to select a short section. Try to export that as a test. Don't render before you export.
    If that doesn't work, copy the project and paste it into a fresh project. Try another export test.
    If that doesn't work, create a new user account.
    As for Blu Ray, there is a Share preset if want to check it out. Very simple menus. And the preset can only handle single tracks.
    Good luck.
    Russ

  • "Macros in this project are disabled..." error message when creating PDF files

    The following error occurs when creating a PDF file using a document that was created from a MS Word 2007 templates.
    "Macros in this project are disabled..."
    The security settings are set appropriately - it's not that. I have done everything I can think of including asking Microsoft; they say it's not them. It may not be, but I do not know how to get around it. It did not happen before upgrading my templates to the Office 2007 format.
    Has this happened to anyone else? There is no coding within th etemplates regartding PDFs. We are using Adobe Professional X.  The error only occurs when we use Adobe Pro X.
    One thing I just noticed, our templates get the following message when we go to save as a PDF using Adobe:
    Acrobat PDFMAker needs to save the file before continuing. Do you want PDFMaker to save the file and continue?

    Does it work the first time after you delete your Normal.dotm file? You may be running into the same issue that is detailed in this post Unable to open document. Please check to see if you have read permission for the above file.

  • Error message when creating...help!

    Please help.. I'm getting this error message when I try creating a PDF "error/usr/lilbexec/cups/filter/pstops failed"

    This is the forum for the free Adobe Reader and since it doesn't create PDF's, you'll need to be a bit more specific about what you are doing and what you are using. Maybe then we can point you in the right direction.

  • Error message when no atachment found for the workitem while approving ?

    Hi Folks,
    I need some help in this issue please.
    Requirement is, Agent needs to attach a document to work item and then approve. To achieve this, i have put code in for complete execute condition of the step.
    This is how it works, when agent attaches doccument and approves, it completes workitem and when there is no attachment, it does not complete work item but it does not stop agent by throwing anykind of error message.
    I need a error message when there is no atachment found for the workitem and agent tries to approve it. Please suggest how i can get this done ?
    Thanks a lot in advance..
    Prasu

    Hi
    There a couple of different ways to accomplish this.
    If your not using standard task/methods your able to extend your method. In here just check if a document is attached, display a message with the message statement, or a FM (e.g. TH_POPUP_TO_INFORM), and then call the workflow statement "<b>Exit_Cancelled</b>", by doing this the workitem will stay in the inbox, in status in process until the document is attached.
    If your using standard task / Methods, you need to check if a document is attached in the workflow logic, preferably in a condition. Now - if no document has been attached create a loop, and within this loop create a task, for displaying the message. A easy solution here could be a simple decision task with only one Decision, or if you are able to do some ABAP development, create a small method for displaying the message.
    In order to make sure that this task/message will popup immediately, create a container element e.g. "Last_Agent", the do a binding from the decision task to the workflow container ActualAgent -> Last_Agent.  Now you Last_Agent as the agent for you "Display Message" Task
    Regards
    Morten Nielsen

  • Item Category not Defined Error message when deleting a batch item in Deliv

    Hi,
    I am trying with a Intercompany transfer . So after creating Interco. Transfer we have followed with a delivery document.
    Now,we would like to delete the delivery document. For your info. Del. doc is still open. We haven't gone for Goods issue or anything else.
    So,we tried removing the batch line item in batchsplit tab of the delivery and then deleting the delivery document.
    But we get the error message "Item catgeory Not defined". but we could see entries for Item category Determination with the particular Delivery typeItem Category Group from Material MasterItem Usage+Item Category.
    Why does system throw "Item catgeory Not defined".  when there are entries for particular determination available .
    And this seems to be Syste
    Thanks,
    Dhilipan

    Hello Sandy,
    Thanks for ur update. But its ticked already.. We checked it.
    But we still face this issue. And we are not able to replicate the same issue in QA..What cud be the reason.
    But Config..seems exactly similar to Pro. and QA
    Thanks,
    Dhilipan

  • [Solved Kinda] Error Message when creating a LVM Snapshot.

    I upgraded my Arch Laptop this morning, which among other things, also had an update for lvm2.
    Anyways, as part of my backup strategy I create a LVM Snapshot of root and transfer that via rdiff-backup.
    This used to work no problem. But ever since the update, whenever I create the snapshot, I get the following error message at the console:
    lvcreate -L1G -s -n SnapRoot /dev/vg/root
      The link /dev/vg/SnapRoot should had been created by udev but it was not found. Falling back to direct link creation.
      semid 294912: semop failed for cookie 0xd4da0ca: incorrect semaphore state
      Could not signal waiting process using notification semaphore identified by cookie value 223191242 (0xd4da0ca)
      semid 294912: semop failed for cookie 0xd4da0ca: incorrect semaphore state
      Failed to set a proper state for notification semaphore identified by cookie value 223191242 (0xd4da0ca) to initialize waiting for incoming notifications.
      Logical volume "SnapRoot" created
    It still creates the Snapshot volume, but I wasn't sure if it wasn't corrupted or something. Does anyone know what this error message means? Can I safely ignore it?
    By the way, I don't know if its relevant, but my partition setup is like this:
    /boot is a standard ext2 volume
    /root is a unencrypted LVM2 volume
    /home is LUKS Encrypted Volume ON TOP of a LVM2 volume.
    Swap is also a LVM2 volume.
    ######update#####
    Well, I don't know what changed, but this evening, I tried the whole lvm snapshot deal again, and this time there was no error message.
    Perhaps some timestamps or something were wrong, or not as they should have been. Either way, I have no idea what might have changed. Since I definately tried one or two reboots to see if that would have fixed the problem.
    Oh well.
    Last edited by ChojinDSL (2010-11-30 21:20:48)

    Go to Preferences and turn off Background Rendering.
    Select your project in the library and in the File menu, click on Delete project Render Files; choose All when prompted. Select your event and do the same with the event Render files. In the project use the range tool to select a short section. Try to export that as a test. Don't render before you export.
    If that doesn't work, copy the project and paste it into a fresh project. Try another export test.
    If that doesn't work, create a new user account.
    As for Blu Ray, there is a Share preset if want to check it out. Very simple menus. And the preset can only handle single tracks.
    Good luck.
    Russ

  • Error Message when creating Purchase Requisition

    Hello,
    We are on SRM 4 version in classic scenario.
    We are creating a limit shopping but when he has been approved we got an error from the backend system :
    Shopping Cart XXXXX3 (Purch. Requisition XXXXX): ME020 Item category X not allowed with document type XX
    the same user has already created a shopping cart on limit with no problem but not on the same plant/cost center/gl account...
    Do  you have an idea of the error message solution?
    Thanks!

    Hello,
    Check the following settings in ECC system.
    1) IMG -> Materials Management -> Purchasing -> Purchase Requisition ->     
    Define Document Types                                                       
    Select "EC", (or those related with BBP), then double click on              
    "Allowed Item Categories".                                                                               
    2) IMG -> Materials Management -> Purchasing -> Purchase Order ->           
    Define Document Types                                                       
    Select "EC", (or those related with BBP), then double click on              
    "Allowed Item Categories".                                                  
    Also, check if note 140846 is applied.
    Kind regards,
    Ricardo

  • Error message when creating new document

    I am using Photoshop CS5 on OSX 10.6.8. When I try to create a new file or copy and paste within an open file, I receive this error message: "This is not a valid Portable Document File (PDF) document. It cannot be opened." This does not occur when opening files, only when creating a new document or working within an open document. I have tried deleting preferences and resetting all warning messages but nothing has worked. Help!

    My first guess would be that something is busted with your global PDF handling, meaning OSX' own Preview and printer stuff. I believe there's an option to turn off this behavior that Apple introduced with OSX 10.6.x, but as a non-Mac person I can't be more specific than that....
    Mylenium

Maybe you are looking for

  • How can i use my iPod on two different computers?

    I recently bought a new laptop and i plugged in my ipod shuffle but i cant add any new music to it because it was originally set up on my old laptop. Unlike other ipods, when i plug it back into the old laptop, there is no box to check like "Manually

  • 5800 using AT&T sim card

    I have recently got a 5800Xpress Music which has been unlocked. I take my AT&T sim and put into the phone, the phone works, the WLAN works but I can not get any internet connections. I continue to get Packet Data: Packet Data Connection not available

  • So does any Linux have a built in firewall?

    I hear that the Linux kernel has a firewall called iptables built in and working. How secure is it? Is it included with Arch by default? I am just wondering because there is a package called iptables in the repos...

  • Right clicking causes WindowServer hang

    Hi there, I'm running an nVidia GTX 285 and a GT 120 in my 2008 Mac Pro, with 32GB RAM and a RAID 0 setup. Lately, on my third screen solely powered by the GT 120, right-clicking has caused a brief flash of white (usually a square the same size as th

  • Need DVI splitter.

    Want to have 2 monitors on my mini. Where can I find a DVI splitter?