Insert into Sql Server Database?

2 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    23 posts
    Member since:
    Jan 2012

    Posted 10 Feb 2012 Link to this post

    In order to get around not being able to manipulate flash objects, I decided create inserts in the backend since we are not concerned with how the flash object operates, but it is essential to our product.  

     

    thisCommand.CommandText = "INSERT INTO TEST VALUES('TEST')"
    (Test table only has 1 column)

     


    For some reason I can't write into a sql server database from Telerik.  I have been able to read  though.  The line of code above does nothing and script step still passes.  I have used the same connection string and command in a .vb file and have been able to insert.  Is there something that I am missing?

    Thanks,

    Jonathan


  2. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 13 Feb 2012 Link to this post

    Hi Jonathan,
    I've expanded out article on accessing an SQL DB. It now includes an example demonstrating how to write into an SQL db (near bottom of article). Check it out here:
    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/access-sql-database.aspx

    The example is correct - I tested it out. Just make sure that you're working with the right value type. For instance I had defined my column as consisting of nchar(10) values. This means that the string values that it holds exceed 10 characters. At first my code was failing because I was trying to write a String that bigger than that. Just something to keep in mind.

    Let me know if you're still unable to get this to work.

    All the best,
    Stoich
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top