Error in MSSQL Code unable to figure out error

I have a program, that updates a table, it inserts the following:
strSQL = "INSERT INTO test-vm_info(info, DateTime) VALUES ('Program Started','1/10/2015 9:29:50 PM')"
it fails with error:  Incorrect syntax near '-'.
I created the database with the - so I believe that there is no issue with the -.
Any ideas would be grateful
THanks
Update:   I just checked and I see the table was not created.    It is now allowed to have - in a table name?
Thanks
 update 2:  found some stuff that says put [] around the name,  can this always be used?
Thanks

Hi Joe,
without delimiters only
regular identifiers are allowed, and a minus ("-") isn't allowed. You will have to use delimiters - square brackets or double quotes for those identifiers.
Consider using always regular identifiers as it avoids such errors - here use a underscore ("_") instead. Note:
DateTime is a data type and it is better to avoid any data types names and
reserved keywords for identifiers.
Additionally: Instead of literal strings use
parameters - as otherwise the date time value depends on the users language settings, see
The ultimate guide to the datetime datatypes. A simple example using
AddWithValue:
Using connection As New SqlConnection("Data Source=(local)\SQLEXPRESS;Integrated Security=True;Initial Catalog=tempdb;")
connection.Open()
Dim command As New SqlCommand("INSERT INTO [test-vm_info](info, [DateTime]) VALUES (@info, @infodate);", connection)
command.Parameters.AddWithValue("@info", "Program started")
command.Parameters.AddWithValue("@infodate", DateTime.Now)
command.ExecuteNonQuery()
End Using
Regards, Elmar

Similar Messages

  • Importing cd's and suddenly can't see the recently added folder, have been unable to figure out how to re-display it, know the songs are going somewhere

    Was importing cd's and suddenly can't see recently added folder, been unable to figure out how to re-display it, know the songs are going somewhere

    See Restore Original Smart Playlists.
    tt2

  • HT1386 unable to figure out how to synch iTunes new laptop to new iPhone

    New mac user with new iphone 5 unable to figure out how to synch my itunes to new phone. 

    Have you checked all of the tabs on the iPhone profile? Do you have all of your sync options set up as you want them on each tab on the profile? (by Profile, I mean the screen that displays with the various tabs when you connect your phone to the Mac).
    Cheers,
    GB

  • I am trying to re install my lightroom student addition.  I have the serial number and was told to do the trial again and then update to purchase. i am unable to figure out how to do this

    i am trying to re install my lightroom student addition.  I have the serial number and was told to do the trial again and then update to purchase. i am unable to figure out how to do this

    Emily5lexi which version of Lightroom are you wishing to install?  Also what operating system are you using?

  • I have Maveriks. I downloaded numerous ACID Fonts and purchased Stuffit as instructed by ACID Fonts in order to use them. However, now I am unable to figure out how to get them into my Font Family drop down list or insert into Pages. PLS HELP!

    I have Maveriks. I downloaded numerous ACID Fonts and purchased Stuffit as instructed by ACID Fonts in order to use them. However, now I am unable to figure out how to get them into my Font Family drop down list or insert into Pages. PLS HELP!

    Hi FancyJean!
    Here is an article for you about using Font Book and installing fonts that you have downloaded:
    Mac Basics: Font Book
    http://support.apple.com/kb/ht2509
    Thanks for being a part of the Apple Support Communities!
    Cheers,
    Braden

  • Unable to figure out how to delete photos, there is no trash can in upper right corner?

    Unable to figure out how to delete photos, there is no trash can in upper right corner?

    Only photos taken with the iPad, copied onto it via the camera connection kit, or saved from emails/websites etc can be deleted directly on the iPad - either via the trashcan icon in the top right corner if viewing the photo in full screen, or via the icon of the box with the arrow coming out of it in thumbnail view.
    Photos that were synced from your computer are deleted by moving/removing/de-selecting them from where they were synced from on your computer and then re-syncing.

  • Urgently, Help. Stuck on this issue when unable to figure out what methods to use...

    Urgently, Help. Stuck on this issue when unable to figure out what methods to use...
    Attachments:
    enquiry.jpg ‏101 KB

    so sorry about that
    I have an example attached.
    How to control the pause function automatic control by the system timing? when only reaches 0000hrs, pause function execute?
    Attachments:
    pause_button.vi ‏16 KB

  • Unable to figure out the classnotfoundException

    Dear Members,
    I have an applet on which I want to show images. I have put .class and .html in the same directory and the images in the images directory.
    I'm usong Tomcat 5.5.4.
    Note: I have created certificates and also policy files for the applet.
    When I run the same code using eclipse, the code is working fine.
    And when I try to run in the browser its throwing the following Exceptions.
    java.lang.NoClassDefFoundError: AdminApplet1$1
         at AdminApplet1.init(AdminApplet1.java:74)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source) Where AdminApplet1 is my applet.
    Following is the code written in the .html
    <applet codebase="http://localhost:8080/project/"
            code="AdminApplet1"
            archive="SAdminApplet1.jar"
            height=400
            width=600 >
    </applet>where SAdminApplet1.jar is signed jar.
    I'm trying to figure out the problem since last 2 days. If you want more details about the problem please let me know.
    I have referred http://java.sun.com/developer/technicalArticles/Security/Signed/
    for creating the certificates
    If you think I've gone wrong while creating the certificate then please show me a way.
    I'm looking forward for the helping hands.
    Thanks.

    Please put all the class files in the jar.
    Considor this example:
    import java.applet.*;
    public class test extends Applet {
         public void start() {
              System.out.println("this is start");
              try{
                   System.out.println(System.getProperty("java.version"));
                   (new subTest()).printSomething();
              }catch(Exception e){
                   e.printStackTrace();
         public void init(){
              System.out.println("this is init");
         class subTest{
              void printSomething(){
                   System.out.println("something");
    }compiling with javac test.java gives me:
    test.class
    test$subTest.class
    When I remove test$subTest.class and open the applet with a html page I get:
    java.lang.NoClassDefFoundError: test$subTest
    (looks familiar?)

  • TS3354 I have downloaded the latest version of ITunes But was unable to figure out how to play the movie .What steps can I take ?

    Hi
    I have downloaded the latest version of ITunes .I cant' figure out the steps to take , to actually watch it on my computer. Where do I click to watch the movie ?
    Can someone walk me through it ?

    Contact Adobe. That is what I finally had to do. the number is 1-800-833-6687. There was a problem with a file. They took over my computer and got everything working for me.
    Shane

  • Unable to figure out the source of a standard purchase order

    Hi ,
    I have identified a PO in the system which cannot be opened. When I query the PO in the purchase summary form, the 'Open' button is greyed out.
    When I go to Inquire -> View Action History , only one sequence is present ------ Action is close . There is no sequence pertaining to Submit or Approve,
    Can someone please tell me , how to check where this PO has been sourced from ?
    Regards.

    Hi,
    The actual problem which lead to the above question is the following :-
    1.  The Consigned PO Orders are not getting picked up in PO Approval process.
    I would like to know if there is any setup by which we can achieve this. You will not be able to see the Consigned Purchase Orders in Purchase Orders screen as well.
    How to check Consigned Purchase Orders?
    SELECT * FROM PO_HEADERS_ALL WHERE consigned_consumption_flag = 'Y'
    What is Consigned Purchase Orders?
    MIT Sourcing &amp;amp; Procurement - Policies &amp;amp; Procedures

  • I am unable to figure out how to cancell this service.  Please cancell it for me asap. anne.stawiski

    I need to cancell my service.  It is not working for me. Just signed up today.  [email protected] is my id

    Hi,
    I am sorry the subscription did not work out for you. I have cancelled your subscription, and set the refund process in motion.
    Your refund no.is 66183193.
    Regards,
    Florence

  • Unable to figure out where all the space on my Mac is

    Hi,
    I am trying to install some Oracle software on my macbook pro (Weblogic server). I have enough space on the HDD
    $ df -h
    Filesystem      Size   Used  Avail Capacity  iused     ifree %iused  Mounted on
    /dev/disk0s2   465Gi   46Gi  419Gi    10% 12010062 109876680   10%   /
    But the installer keep prompting for Insufficient disk space! error.
    $ pwd
    /Users/SonyMac
    $ du -csh .
    26G          .
    26G          total
    I am not sure where is the 419 GB space distributed and how can I allocate more space under /Users/SonyMac. Any help will be appreciated.
    Regards
    Subhankar

    subhankarsahu,
    how old is this software that you are trying to install? Could it be that it thinks that 419 GB of free space is an impossibility? That message states that the installer requires less than 2 GB of free space.
    What is the output from these commands?
    x=/Users/SonyMac/Oracle/Middleware1/wlserver_10.3
    du -ms $x
    ls -ld $x
    ls -l $x

  • Unable to figure out how to connect with another S...

    First off, my Skype number keeps saying invalid. I have credit. Second, my profile reads my flour number is not active. I had this one originally #########. Yesterday I attempted to change it or add a new one #######. I was never given any type of confirmation as to whether my Skype number changed to the latter number 732... Or not. I can use either one it's just when the original wasn't working I thought I should try to change. I NEED TO CONNECT WITH SOMEONE IN THE UK who is also having difficulty on his end. His number he created to speak with me here is #######. His Skype name is xxxxx8 I am pending request to link to him. But why are my numbers telling me they're invalid? MUST I HAVE WIFI TO CONNECT? I do not of that's the case. My email is [email protected]
    * mod edit: please do not post private information/email/ID *

    Only photos taken with the iPad, copied onto it via the camera connection kit, or saved from emails/websites etc can be deleted directly on the iPad - either via the trashcan icon in the top right corner if viewing the photo in full screen, or via the icon of the box with the arrow coming out of it in thumbnail view.
    Photos that were synced from your computer are deleted by moving/removing/de-selecting them from where they were synced from on your computer and then re-syncing.

  • Unable to Figure out Fax issue

    Hi Folks,
    I have done coding to convert smartforms to  OTF and send as PDF attachment as FAX..
    I have used the function module CONVERT_OTF_AND_FAX... I have debugged the function module but i didn't find any error. also i am getting OTF <somenumber>, not sure what is this number
    When i go and check SOST i don't find any entry there..
    I am confused whether the fax has gone or not...
    Can anybody throw somelight if the fax functionality is working or not, by looking the above things.
    Regards,
    Raj

    Hi Keshav,
    Until yesterday i was getting the TELEFAX in SOST with waiting status , provided correct FAX Number, while trying to day i am not getting any entry in SOST.. confused what is happening...
    Regards,
    Raj

  • Unable to figure out paper sizes in PSE 9...

    Hi, I am trying to print a 4x6 photo... when I click print the pse print window opens and asks to select: printer, paper size & print size.  I don't know what paper sizes they are offering, ex: KG, KG.NMg,  PhotoPaper2L, PhotoPaper2L.NMgn, PhotoPaperRoll, PhotoPaperRollNMgn, etc.... ??  When I select these and try to print my 4x6, my image is cut off the edge.  What are these paper sizes? and what should I select to print a standard 4x6 photo?  Thanks for your help.

    Thanks for your reply, "no margin" is probably right, but still unsure what the sizes are.  I don't know why'd they be metric.  Other options on the list were the standard: a4, letter, legal, 8x10in (that looks like a photo size), and some other ones I've never seen before: HiVision 102x180 , Env10 (guessing envelope size), A6.Maximum (??), and Halfletter.  These are the selection for the window for PSE9.... once I move to the next window (after selecting print on the pse window)... my printer window comes up and all is well, though there is not a place to select paper size, just paper type (glossy, etc).  Very frustrating to waste so much costly photo paper.

Maybe you are looking for