Results 1 to 11 of 11

Thread: Connection.execute querry not saving the data in database.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2012
    Posts
    23

    Connection.execute querry not saving the data in database.

    Dear Sir,

    i am putting some data in the database through vb application through below qeurrry.

    connection.execute("delete from table where ID = 'ABC' ")

    qurry works fine and i can see the correct results. but when i close and run again this application, it appears that above querry has not saved the result or has not updated the database.

    Point to be noted, database is of SQL 2008, and database resides in another computer machine whithin the network.

    please help.

    Thanks and best regards.
    Imran Khaldi

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Connection.execute querry not saving the data in database.

    Moved From The CodeBank (which is for sharing code rather than posting questions )

  3. #3
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Connection.execute querry not saving the data in database.

    This is almost certainly due the settings for the database in your project. You're database is being copied every time you run your project and your delete is being performed on the copy, not the original. When you finish running the copy is discarded and your changes are lost. Have a look round for a member called JMcIllhiney. I'm pretty sure he's got a link in his signiature which explains it very well and tells you how to fix the problem.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  4. #4
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Connection.execute querry not saving the data in database.

    here you go. I found the link for you. The forums being a bit glitchy at the moment so I can't post it as a link but here's the url.
    http://msdn.microsoft.com/en-us/libr...89(VS.80).aspx

    OK, it interpreted the url automatically, nice.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  5. #5
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,531

    Re: Connection.execute querry not saving the data in database.

    Hmmmm Funky read something different from me...
    while his assessment jives with my initial reaction.... this bit:
    database is of SQL 2008, and database resides in another computer machine whithin the network.
    Seems to indicate a SQL Server sistuation... and not necessarily a local files issue... I could be wrong though.

    That said... I NEVER... EVER, use the connection.execute that way... personally I think it's more prudent and better to create a connection, create a command, create parameters as necessary, and then execute the COMMAND...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,900

    Re: Connection.execute querry not saving the data in database.

    Seems to indicate a SQL Server sistuation
    Ooh, actually you're probably right. I clearly wasn't paying attention.
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Connection.execute querry not saving the data in database.

    Is your application written in VB6 or VB.NET? You appear to be using ADO so that would suggest VB6, although it would work in VB.NET too.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Jun 2012
    Posts
    23

    Re: Connection.execute querry not saving the data in database.

    thanks for your openion but i am still unable to resolve the matter.
    for you reference i am using quetty as under.


    ============
    dim insertquerry as stringg

    insertquerry= "insert into customer values ('name', 'id', 'address')"

    connection.execute(inserquerry)
    ===========

    waiting for further help to resolve the matter.
    Thanks and best regards.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Jun 2012
    Posts
    23

    Re: Connection.execute querry not saving the data in database.

    thanks for your openion but i am still unable to resolve the matter.
    for you reference i am using quetty as under.


    ============
    dim insertquerry as stringg

    insertquerry= "insert into customer values ('name', 'id', 'address')"

    connection.execute(inserquerry)
    ===========

    waiting for further help to resolve the matter.
    Thanks and best regards.

  10. #10
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Connection.execute querry not saving the data in database.

    We're none of us going to get very much further if you don't indicate how you're setting up the connection and, more importantly, demonstrate that you are opening the connection prior to the command. You won't necessarily get an error if you execute a command on a connection that is closed but it certainly won't do what you want it to.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: Connection.execute querry not saving the data in database.

    I'm still waiting for an answer to my question too:
    Quote Originally Posted by jmcilhinney View Post
    Is your application written in VB6 or VB.NET? You appear to be using ADO so that would suggest VB6, although it would work in VB.NET too.
    You say that you're waiting for further help but you refuse to provide information that we've requested in order to help you. Is your time inherently more valuable than ours?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width